Import Harvest Data to Google Sheets
Harvest is a popular time tracking and invoicing tool that provides numerous integrations, but no official integration for Harvest and Google Sheets. In this guide, we’ll walk through how to pull data from the Harvest API directly into Google Sheets, using the API Connector add-on. We’ll first get a personal access token from Harvest, and then set up a request to pull in data from Harvest to your spreadsheet.
- Part 1: Get your Harvest Personal Access Token
- Part 2: Create your API Request URL
- Part 3: Pull Harvest API Data into Sheets
- Part 4: More Example API URLs
- Part 5: Handle Filters
- Part 6: Handle Pagination
PART 1: GET YOUR HARVEST PERSONAL ACCESS TOKEN
- Sign into Harvest and navigate to their Developer Tools page (https://id.getharvest.com/developers)
- Click “Create New Personal Access Token”
- Give it a name and click “Create Personal Access Token”. You can name it anything, but we’ll call it ‘Google Sheets’ here.
- You should now see a page containing all your API access details. Congrats! You’re now ready to access the Harvest API. Keep these details handy as we’ll need them in a moment.
PART 2: CREATE YOUR HARVEST API REQUEST URL
- API root: https://api.harvestapp.com/v2
- Endpoint: /time_entries
- Parameters: ?page=PAGE_NUMBER
Parameters Example: ?page=1
The ‘page’ parameter is optional but we’ll include it to show how parameters work. Putting it all together, we get the full API Request URL:
PART 3: PULL HARVEST API DATA INTO SHEETS
We can now enter all our values into API Connector and start importing Harvest data into Google Sheets.
- Open up Google Sheets and click Add-ons > API Connector > Open.
- In the Create screen, enter the Request URL we just created:
- Under Headers, enter the following key-value pairs (again, if you’re connecting through the OAuth2 connections manager, you only need to enter the Harvest-Account-Id header.):
Harvest-Account-Id YOUR_ACCOUNT_ID Authorization Bearer YOUR_TOKEN User-Agent YOUR_TOKEN_NAME (YOUR_EMAIL)
Just substitute in your own values using the values from your API access details page and your own email address. The whole thing should look something like this:
- If you’re using the OAuth2 connection manager, choose “Harvest” from the drop-down authentication menu. Otherwise, just leave it as “None”.
- Create a new tab and click ‘Set current’ to use that tab as your data destination.
- Name your request and click Run. A moment later you’ll see Harvest data populate your Google Sheet:
PART 4: MORE EXAMPLE API URLS
You can check the documentation for the full list of available API requests, but if you just want to jump in, you can play around with the URLs you enter in the API URL path field. Try the following (one at a time):
PART 5: HANDLE FILTERING
You may want to limit your pulls for certain client IDs. You can combine parameters like this:
https://api.harvestapp.com/v2/time_entries?client_id=1234567&page=1 (you can find your client ID in the “clients” table).
PART 6: HANDLE PAGINATION
Harvest limits the number of records returned in each request. By default, only 100 records will be returned unless you use the ‘page’ parameter as described in their documentation.
Each page contains 100 records. To access more than 100 records, edit the “page” parameter to your URL path, like this:
With API Connector, you can either set these up as separate requests or loop through them automatically with pagination handling (paid feature), like this:
Following the above steps, you will now be able to import data from the Harvest API directly into Google Sheets. By setting Google Sheets as a data source, you can also use this method to create Harvest data visualizations and dashboards in Google Data Studio.