Importing Data from QuickBooks API to Excel in Python

Importing Data from QuickBooks API to Excel in Python

QuickBooks is an accounting program designed for small and mid-size businesses. The QuickBooks Online API is an open platform that enables developers to integrate with rich financial and transactional data through REST-based APIs and offers unparalleled reach to millions of small businesses through Intuit Apps.com. The QuickBooks Online API is designed to be easy to use, but development can be complex, and challenging and at times. Intuit, the company behind the QuickBooks API, has made it simple for developers to create apps with API integration that will automate changes to QuickBooks accounts.

QuickBooks
  • Connection to QuickBooks API in Python

For making a successful connection to QuickBooks API, we will use a python library named “python-quickbooks”. The documentation and usage is explained on https://pypi.org/project/python-quickbooks/.

QuickBooks Online APIs uses the OAuth 2.0 protocol for authentication and authorization. Intuit supports use cases for server and client applications. To begin, obtain OAuth 2.0 client credentials by creating a new QuickBooks Online application in your Intuit Developer Account. 

  1. Setting up an AuthClient passing in your CLIENT_ID and CLIENT_SECRET.
Code 1

2. Create a QuickBooks client object passing in the AuthClient, refresh token, and company id.

Code 2
  • Object Operations
  1. Getting list of objects
Code 3

2. Once the list of objects are received in a variable, we can get many attributes like “balance”, “name” or “amount” from a single object using inbuilt functions related to the python package. Below image displays a snippet of the code used to extract information and later saving it to an excel file.

Code 4

Leave a comment