Connecting Microsoft Excel to Xero
The Xero ODBC Driver enables you to connect Microsoft Excel to Xero and work with Xero data in your spreadsheets.
The Xero ODBC Driver is available to download from the Easysoft web site:
- Download the Windows Xero ODBC Driver. (Registration required.)
- Install and license the Xero ODBC Driver on the machine where Excel is installed.
For installation instructions, see the Xero ODBC Driver documentation.
Now, create a Xero app, which the Xero OAuth mechanism will use to authorise and keep track of your ODBC connection. We recommend that you create a Xero app for each Xero ODBC data source that you create.
To do this:
- Add a Xero Oauth application, by choosing New App.
- In the Add a new app screen, enter a meaningful name in the App name box.
- In the OAuth 2.0 grant type section, choose Auth code Web app.
- Enter your organisation's web site URL in the Company or application URL box.
- In the OAuth 2,0 redirect URL box, enter:
- Choose the Create app button.
- In the App details page for the newly created app, copy the Client id. You will need this to create your data source.
- Generate and copy a Client secret. You will need this to create your data source.
Before you can use the Xero ODBC Driver to connect Excel to Xero, you need to configure an ODBC data source. An ODBC data source stores the connection details for the target database (e.g. Xero) and the ODBC driver that is required to connect to it (e.g. the Xero ODBC driver).
You can configure a User ODBC data source, which is only available to the user who creates it, or a System ODBC data source, which is available to all users on the machine. You configure ODBC data sources in ODBC Administrator, which is included with Windows.
64-bit Windows There are two versions of ODBC Administrator on this platform. (If you are not sure whether your version of Windows is 32-bit or 64-bit, follow the instructions in this Microsoft Knowledge Base article to find out.) The version of ODBC Administrator that you need to run depends on whether you have a 32-bit or a 64-bit version of Excel. To find out which version of Excel you have, start Excel, and then start Windows Task Manager. In Task Manager, choose the Processes tab. Look for Excel.exe in the list. If this process name is followed by *32, your version of Excel is 32-bit. Otherwise, your version of Excel is 64-bit.
If you have the 64-bit version of Excel, you need to run 64-bit version of ODBC Administrator. To do this, open Administrative Tools in Control Panel, and then open Data Sources (ODBC). (On Windows Server 2003 and earlier, the Control Panel applet that launches ODBC Administrator is labelled Data Sources. On Windows 8 and later, the Control Panel applet is labelled ODBC Data Sources (64-bit).)
If you have the 32-bit version of Excel, you need to run 32-bit version of ODBC Administrator. To do this, in the Windows Run dialog box, type:
32-bit Windows To run ODBC Administrator on 32-bit Windows, open Administrative Tools in Control Panel, and then open Data Sources (ODBC). (On older versions of Windows, the Control Panel applet that launches ODBC Administrator is labelled Data Sources.)
Use ODBC Administrator to create your Xero ODBC Driver data source:
Do one of the following:
- To create a User data source, in the User DSN tab, choose Add.
- To create a System data source, choose the System DSN tab, and then choose Add.
- In the Create New Data Source dialog box, choose Easysoft ODBC-Salesforce Driver, and then choose Finish.
- Complete the Easysoft ODBC-Xero Driver DSN Setup dialog box:
Setting Value DSN Xero Organisation
The name of your Xero Organisation, for example "Demo Company (UK)".
Client Id The Client Id for the Xero app that you created for this data source. Client Secret The Client Secret for the Xero app that you created for this data source.
- Choose the Authenticate and obtain token button and follow the onscreen instructions.
- Use the Test button to verify that you can successfully connect to Xero.
You can now connect Excel to Xero.
Example: How to return data from Xero to Microsoft Excel by using Microsoft Query
- Do one of the following:
- For Excel 2007 and later, on the Data tab, in the From Other Sources group, choose From Microsoft Query.
- For Excel 2003 and earlier, on the Data menu, choose Import External Data, and then choose New Database Query.
The New Database Query command uses Microsoft Query to import data. Microsoft Query is an optional feature, which by default is not installed. If you do not have Microsoft Query installed, choosing New Database Query will prompt you to install it. To do this, in Control Panel, choose Programs and Features (or Add or Remove Programs). Choose Microsoft Office (if you installed Excel as part of Office) or Microsoft Excel, and then choose Change. Follow the instructions on screen. Select Choose advanced customization of applications during the Setup wizard if this option is present for your version of Office / Excel. Microsoft Query is located under Office Tools.
When you have installed Microsoft Query, repeat step 1.
- In the Choose Data Source dialog box, choose your Xero ODBC driver data source from the list, and then choose OK.
- In the Query Wizard, choose the columns that contain the data you want to retrieve, and then click Next.
- If you want to return a subset of the data, use the Filter Data screen to filter the results of your query (this is the equivalent of a SQL WHERE clause), and then click Next.
- If you want to change the sort order of your data, use the Sort Order screen to sort the results of your query (this is the equivalent of a SQL ORDER BY clause), and then click Next. Click Finish to return your Xero data to Excel.