How to connect to Salesforce Data Cloud Data from MS Excel on Mac OS X



Create a Data Source Name in iODBC with the CData ODBC Driver for Salesforce Data Cloud and work with Salesforce Data Cloud data in Microsoft Excel on Mac OS X.

Microsoft Excel features calculations, graphing tools, pivot tables, and a macro programming language that allows users to work with data in many of the ways that suit their needs, whether on a Windows machine or a Macintosh machine. This article walks through creating a DSN for Salesforce Data Cloud data in iODBC and accessing Salesforce Data Cloud data in Microsoft Excel, all on a machine running Mac OS X.

Installing the CData ODBC Drivers on Mac OS X

The CData ODBC Driver for Salesforce Data Cloud is preconfigured for the iODBC driver manager, as are many other products like Microsoft Excel. This makes the driver easy to use with these tools.

Licensing the Driver

In a terminal run the following commands to license the driver. To activate a trial license, omit the key input.

cd "/Applications/CData ODBC Driver for Salesforce Data Cloud/bin"
sudo ./install-license <key>

Defining a DSN for iODBC with odbc.ini

You can define ODBC data sources in sections in the odbc.ini file. User data sources can only be accessed by the user account whose home folder the odbc.ini is located in. System data sources can be accessed by all users. You can find the correct odbc.ini in the following paths:

Privileges  Path
User/Users/myuser/Library/ODBC/odbc.ini
System/Library/ODBC/odbc.ini

Modifying iODBC's system-wide settings requires elevated permissions; to do so, you can use following to open a text editor from the terminal:

sudo nano /Library/ODBC/odbc.ini

Salesforce Data Cloud supports authentication via the OAuth standard.

OAuth

Set AuthScheme to OAuth.

Desktop Applications

CData provides an embedded OAuth application that simplifies authentication at the desktop.

You can also authenticate from the desktop via a custom OAuth application, which you configure and register at the Salesforce Data Cloud console. For further information, see Creating a Custom OAuth App in the Help documentation.

Before you connect, set these properties:

  • InitiateOAuth: GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken.
  • OAuthClientId (custom applications only): The Client ID assigned when you registered your custom OAuth application.
  • OAuthClientSecret (custom applications only): The Client Secret assigned when you registered your custom OAuth application.

When you connect, the driver opens Salesforce Data Cloud's OAuth endpoint in your default browser. Log in and grant permissions to the application.

The driver then completes the OAuth process as follows:

  • Extracts the access token from the callback URL.
  • Obtains a new access token when the old one expires.
  • Saves OAuth values in OAuthSettingsLocation so that they persist across connections.
  • For other OAuth methods, including Web Applications and Headless Machines, refer to the Help documentation.

    When you configure the DSN, you may also want to set the Max Rows connection property. This will limit the number of rows returned, which is especially helpful for improving performance when designing reports and visualizations.

    In addition to the connection properties required to connect to Salesforce Data Cloud, the Driver property specifies either a driver definition in the odbcinst.ini file or the path to the driver library. Place your connection properties at the beginning of odbc.ini:

    [CData Salesforce Data Cloud Sources]
    Driver = CData ODBC Driver for Salesforce Data Cloud
    

    If you wish to authenticate using OAuth, you will need to add an additional connection property to ensure that the OAuth flow can execute properly:

    Other = CheckPromptMode=False

    Mac OS validates our drivers separately so you need to copy the license file to the appropriate path as well. After you have configured odbc.ini, run the following command.

    sudo cp /Applications/CData ODBC Driver for Salesforce Data Cloud/lib/CData.ODBC.SalesforceDataCloud.lic /Users/<YOUR_USER>/Library/Containers/com.microsoft.Excel/Data/.cdata/

    Additionally, in the ODBC Data Sources section, the DSN must be set to a driver defined in the odbcinst.ini file. For example, below is the entry for the DSN created during the driver install:

    [ODBC Data Sources]
    CData Salesforce Data Cloud Source = CData ODBC Driver for Salesforce Data Cloud

    Registering a DSN for iODBC with odbcinst.ini

    You may need to modify the installed driver definition if you change the path to the driver library. To register an ODBC driver, modify the odbcinst.ini file. With iODBC, drivers can be available to only one user account or drivers can be available system wide. You can find the correct odbcinst.ini in the following paths:

    Privileges  Path
    User/Users/myuser/Library/ODBC/odbcinst.ini
    System/Library/ODBC/odbcinst.ini

    Drivers are defined in sections in the odbcinst.ini file. The section name specifies the name of the driver. In this section, the Driver property specifies the path to the driver library. The driver library is the .dylib file located in the lib subfolder of the installation directory, by default in /Applications/CData ODBC Driver for Salesforce Data Cloud.

    [CData ODBC Driver for Salesforce Data Cloud]
    Driver = /Applications/CData ODBC Driver for Salesforce Data Cloud/lib/libsalesforcedatacloud.odbc.dylib

    The ODBC Drivers section must also contain a property with the driver name, set to "Installed".

    [ODBC Drivers]
    CData ODBC Driver for Salesforce Data Cloud = Installed

    Testing the Connection

    You can test your connection using the iODBC administrator.

    1. Open a terminal and enter the following command to start the iODBC Administrator with the necessary permissions:
      sudo /Applications/iODBC/iODBC\ Administrator64.app/Contents/MacOS/iODBC\ Administrator64
      
    2. On the Users tab, select CData Salesforce Data Cloud Source.
    3. Click the Test button.

    Accessing Salesforce Data Cloud Data from Microsoft Excel

    You can use the DSN configured above to access Salesforce Data Cloud data from Microsoft Excel.

    1. Open Microsoft Excel and open a spreadsheet (new or existing).
    2. Navigate to the data ribbon, click the drop down next to "Get Data (Power Query)," and select "From Database (Microsoft Query)"
    3. Select the User or System DSN that you previously configured and click OK.
    4. Build your SQL query in the Microsoft Query wizard:
    5. Click Return Data to execute the query and pull data into Excel.

    Using the CData ODBC Driver for Salesforce Data Cloud, you can easily pull your Salesforce Data Cloud data directly into Excel. Once there, you can leverage all of the powerful features native to Excel to analyze, report, transform your Salesforce Data Cloud data, and more!

Ready to get started?

Download a free trial of the Salesforce Data Cloud ODBC Driver to get started:

 Download Now

Learn more:

Salesforce Data Cloud Icon Salesforce Data Cloud ODBC Driver

The Salesforce Data Cloud ODBC Driver is a powerful tool that allows you to connect with live data from Salesforce Data Cloud, directly from any applications that support ODBC connectivity.

Access Salesforce Data Cloud data like you would a database - read, write, and update Salesforce Data Cloud 0, etc. through a standard ODBC Driver interface.