Search API Connector Documentation
Import Harvest Data to 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 for Sheets.
There are 2 ways to connect to the Harvest API:
- Preset "Connect" button (OAuth) premium
- Personal access token. Please check the appendix for detailed instructions to retrieve your token.
- Before You Begin
- Part 1: Connect to the Harvest API
- Part 2: Get your Harvest Account ID
- Part 3: Pull Data from Harvest to Sheets
- Part 4: Fetch and Append New Data
- Part 5: Create a Custom API Request
- Part 6: Handle Pagination
- Part 7: API Documentation
- Appendix: Connect with a Personal Access Token
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Connect to the Harvest API
The easiest way to get started with the Harvest API is through API Connector’s built-in integration.
- In Sheets, open API Connector and create a new request (Extensions > API Connector > Open > Create request)
- Select Harvest from the drop-down list of applications
- Under Authorization, click Connect to Harvest
- You will see a modal asking you to approve the connection. Click Authorize App.
- You’ll then be returned to your Google Sheet, and can verify that your Harvest connection is active.
Part 2: Get Your Harvest Account ID
Harvest requires that you pass your account ID into a header when making requests to the API, so we need to take a quick detour here to find out our account ID. In API Connector, create a custom request and enter the following URL:
Under Authentication, choose Harvest. Choose an output sheet and click Run and you should see your account ID(s) returned into a sheet, under the field name
accounts.id. Mark this ID down as we'll need it for all our other requests.
Part 3: Pull Data from Harvest to Sheets
Now that we have our ID, let’s pull some real data into Sheets.
- Toggle back to the Harvest connection, and choose the
- Enter your Harvest account ID, and select any optional parameters by which you'd like to filter the response.
- Set a destination sheet, name your request, and hit Run.
Part 4: Fetch and Append New Data
Rather than retrieving the entire data set each time you run your request, you can set your request to fetch new data only. There are a few approaches you could take; here’s one:
- Run an initial request to the endpoint you want, e.g.
/time_entries, setting the
toparameters to fetch the initial set of historical data. Let's call this sheet TimeEntries.
- Create a new sheet called MaxDate and find the maximum (i.e. latest) date entry from your initial pull with a function like
- If the result is a number like 44928 instead of a date, first select the cell and click Format > Number > Date.
- Switch your request to Append mode and reference that new date cell like this:
- This will ensure that each request only retrieves data from after the last date in your sheet, and append mode will add each new pull to the end of your existing dataset.
- Set your request to run on a schedule. You won’t need to update your request again.
Part 5: Create a Custom Request
Alternatively, you can run a custom request instead of using API Connector’s built-in integration, using any of the endpoints and parameters shown in the API documentation. To create a custom request, enter the full API URL, select Harvest from the OAuth menu (or connect with a token), and enter a Header of Key =
Harvest-Account-Id, Value =
Here's a sample request setup:
- Request URL:
Part 6: Handle Pagination
Harvest limits the number of records returned in each request. By default, 2000 records will be returned unless you use the 'page' and 'per_page' parameters as described in their documentation.
With API Connector you can either run these request URLs manually or loop through them automatically with pagination handling (paid feature). Harvest provides a "next page URL" so we'll enter it like this:
- Pagination type:
next page URL
- Next page path:
- Run until: choose when to stop fetching data
Part 7: API Documentation
Official API documentation: https://help.getharvest.com/api-v2/
Appendix: Connect with a 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.
- Enter these values into the Headers section, like this. You'll also need to include your email address for the User-Agent key. The whole thing should look something like this: