Your Excel Add-in can connect to a service like QuickBooks and import data into your Excel spreadsheet. This Excel Add-in demonstrates how to connect to QuickBooks, gets sample expense data from a sandbox account provided by QuickBooks, Sandbox Company_US_1, and imports the sample data into a spreadsheet. The add-in also provides a button to create a chart from the sample data.
- Prerequisites
- Configure the project
- Run the project
- Understand the code
- Connect to Office 365
- Questions and comments
- Additional resources
Configure your app at developer.intuit.com to get started.
- Go to https://developer.intuit.com/ and sign up for a developer account, and then sign in.
- In the upper right hand corner, choose My Apps and select an app or click Create new app.
- Once the app is selected, choose Development | Keys, and copy OAuth Consumer Key and OAuth Consumer Secret to a place where you can access them later.
- Download or clone the sample to your local machine.
- Open the solution file QbAdd-inDotNet.sln in Visual Studio.
- In Visual Studio, open Web.config and insert the values for
ConsumerKey
andConsumerSecret
, like this.
<appSettings>
<!-- QuickBooks Settings -->
<add key="ConsumerKey" value="insert your OAuth Consumer Key here" />
<add key="ConsumerSecret" value="insert your OAuth Consumer Secret here" />
<add key="OauthLink" value="https://oauth.intuit.com/oauth/v1" />
<add key="AuthorizeUrl" value="https://workplace.intuit.com/Connect/Begin" />
<add key="RequestTokenUrl" value="https://oauth.intuit.com/oauth/v1/get_request_token" />
<add key="AccessTokenUrl" value="https://oauth.intuit.com/oauth/v1/get_access_token" />
<add key="ServiceContext.BaseUrl.Qbo" value="https://sandbox-quickbooks.api.intuit.com/" />
<add key="DeepLink" value="sandbox.qbo.intuit.com" />
</appSettings>
-
Press F5 to run the project.
-
Launch the add-in by selecting the command button from the ribbon in Excel.
-
Click Connect to QuickBooks to launch the QuickBooks sign-in window.
-
If an error window opens in Visual Studio, click Continue and navigate back to Excel. This error is unrelated to the sample.
-
Sign in to QuickBooks with your QuickBooks developer account.
-
Click Authorize to allow QuickBooks to send data to the add-in.
The task pane will display two actions to choose from. -
Choose Get Expenses to import expenses from QuickBooks into a spreadsheet.
- Home.html - Defines the task pane page on start up, and after the user has logged in.
- Home.js - Handles user interaction for sign in, sign out, get expenses, and insert chart. Here, the
dialogDisplayAsync
API is called to open a dialog window for the user to sign in to QuickBooks. - QbAdd-inDotNet.xml - The manifest file for the add-in.
- QuickBooksController.cs - Gets expense data from QuickBooks.
- FunctionFile.js - Adds a chart to Excel.
- OAuthManager.aspx.cs - Handles sign in to QuickBooks from the dialog API.
We'd love to get your feedback on the Excel Add-in with ASPNET and QuickBooks sample. You can send your feedback to us in the Issues section of this repository. Questions about Office 365 development in general should be posted to Stack Overflow. Make sure that your questions are tagged with [Office365] and [API].
- Office 365 APIs documentation
- Microsoft Office 365 API Tools
- Office Dev Center
- Office 365 APIs starter projects and code samples
Copyright (c) 2016 Microsoft. All rights reserved.