web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Read/Extract data from Dynamics CRM Sales via Python

(2) ShareShare
ReportReport
Posted on by 4

Hello all,

I am very new to Dynamics CRM and have a question. Is there a way to read data from  the dynamics CRM sales database via Python script?

Thanks a lot for your help.

I have the same question (0)
  • Dengliang Li Profile Picture
    Microsoft Employee on at
  • Suggested answer
    fabipfr Profile Picture
    13 on at
    I developed a python package for that. It leverages pandas DataFrames to handle easy data transformations, imports or exports which is what you're looking for. 
     
    The repository and Readme is here:
    https://github.com/fabipfr/DataversePython/blob/main/README.md

    this package contains a get_rows() method where you can filter and choose columns to export. 
    check my blog for detailed examples of the function:

    https://blog.fabianpfriem.com/2025/08/how-to-getrows-in-dataversepython.html
     
    Installation: pip install DataversePython

    hope this helps :)
     
  • Suggested answer
    DAnny3211 Profile Picture
    11,397 on at
     

    Hi there,

    Yes, you can read data from Dynamics CRM (now part of Dynamics 365) using Python by leveraging the Web API provided by Microsoft.

    Here’s a general approach:

    1. Register an App in Azure

    • Go to the Azure Portal and register an application.
    • Assign the necessary API permissions for Dynamics CRM.

    2. Authenticate via OAuth2

    • Use libraries like msal or requests in Python to authenticate and obtain an access token.

    3. Use the Dynamics Web API

    • The base URL typically looks like:
      https://<your_org>.crm.dynamics.com/api/data/v9.2/
    • You can then send GET requests to endpoints like:
      accounts, contacts, opportunities, etc.

    Example Python Snippet

     
    import requests
     
    headers = {
        'Authorization': 'Bearer <access_token>',
        'Content-Type': 'application/json',
        'OData-MaxVersion': '4.0',
        'OData-Version': '4.0'
    }
     
    url = 'https://your_org.crm.dynamics.com/api/data/v9.2/accounts'
    response = requests.get(url, headers=headers)
    data = response.json()

    Let me know if this helps, and please mark the response as helpful if it answered your question 😊

    Best regards!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans