Easysoft Blog

Tue, 17 July 2018

Salesforce SOQL from Apache OpenOffice

The Salesforce ODBC Driver extends the number of applications that you can use Salesforce SOQL from.

To get started:

Before you can use the Salesforce.com ODBC Driver to connect your application to Salesforce.com, you need to configure an ODBC data source. An ODBC data source stores the connection details for the target database (e.g. Salesforce.com) and the ODBC driver that is required to connect to it (e.g. the Salesforce.com ODBC driver).

To run ODBC Administrator (which you use to create a data source), in the Windows Run dialog box, type this command if you are using a 64-bit version of Apache OpenOffice:

%windir%\system32\odbcad32.exe

–Or–

Type this command if you are using a 32-bit version of Apache OpenOffice:

%windir%\syswow64\odbcad32.exe

To create a Salesforce.com ODBC Driver data source:

  1. In ODBC Administrator, choose the System DSN tab, and then choose Add.
  2. In the Create New Data Source dialog box, choose Easysoft Salesforce SOQL ODBC Driver, and then choose Finish.
  3. Complete the Easysoft Salesforce SOQL ODBC Driver DSN Setup dialog box:
    Setting Value
    DSN Salesforce.com
    User Name The name of your Salesforce.com user. For example, myuser@mydomain.com.
    Password The password for your Salesforce.com user.
    Token The security token for your Salesforce.com user, if required.

    To find out whether you need to supply a security token, choose the Test button. If the connection attempt fails with an error which contains LOGIN_MUST_USE_SECURITY_TOKEN, you need to supply one.

    Salesforce.com emails the security token to the email address associated with your Salesforce.com user account. If you have not received a security token, you can regenerate it. Salesforce.com will then email the new security token to you. To regenerate your security token, log in to Salesforce.com and then choose Setup from the user menu. Search for "security token" in the Quick Find box. Click Reset Security Token in the Reset Security Token page. When you receive the token in your email client, copy it and then paste it into the Token field.

  4. Use the Test button to verify that you can successfully connect to Salesforce.com.

OpenOffice Base

Using the Salesforce ODBC driver to access Salesforce data with the OpenOffice Database Wizard:

  1. Open OpenOffice Base.
  2. In the Database Wizard, choose Connect to an existing database, and then choose ODBC. Choose Next.
  3. Browse for your ODBC data source, and then choose Next.
  4. Choose Next, the ODBC data source contains a user name and password, there's no need to re-enter them.
  5. Choose Finish, and then save your database when prompted.
  6. In the OpenOffice Base window, right-click the Account table and choose Open.

Using the Salesforce ODBC driver to work with Salesforce data by using SOQL in a pass-through query:

  1. Open the OpenOffice Base database you created by following the previous instructions.
  2. Choose Queries, and then
  3. Right-click the Query tab, and then choose SQL View.
  4. Enter your SOQL statement in the Query pane. For example:
    SELECT Account.Name, (SELECT Contact.LastName FROM Account.Contacts)
    FROM Account
  5. Choose the Run Query button.

OpenOffice Calc

Using the Salesforce ODBC driver to access Salesforce data from Calc:

  1. Create a new Calc spreadsheet.
  2. On the View menu, choose Data Source.
  3. Expand the Tables or Queries for a Base database that uses a Salesforce ODBC driver data source for its data.
  4. Drag the Table or Query to the Calc worksheet to retrieve the Salesforce data.