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: Create your API Request URL
- Part 4: Pull Harvest API Data into Sheets
- Part 5: More Example API URLs
- Part 6: Handle Filters
- Part 7: Handle Pagination
- Part 8: Fetch New Data Only
- Part 9: 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
If you haven’t connected to the Harvest API before, you’ll first need to initiate the connection.
- Open up Google Sheets and click Extensions > API Connector > Manage Connections.
- In the list of available connections, find Harvest and click Connect.
- 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 in the Connections screen.
Part 2: Get Your Harvest Account ID
Harvest requires that you pass your account ID into a header when making requests to the API. This is actually pretty useful if you’re working with multiple Harvest accounts, since it enables you to differentiate between them.
Therefore, as a precursor to getting data, let’s first find out our account ID. In API Connector, open up the Create tab 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 shortly.
Part 3: Create Your Harvest API Request URL
OK, now let’s get some real data. We’ll start with time entries.
- 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 4: Pull Harvest API Data into Sheets
Let’s get that Harvest time entry data into Google Sheets.
- Open up Google Sheets and click Extensions > API Connector > Open.
- In the Create screen, enter the Request URL we just created:
- Choose “Harvest” from the drop-down authentication menu. It should say ‘Connected’.
- Under Headers, enter your account ID from above as a Header, like this:
- 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 5: 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).
You can also use API Connector’s API Library (just search for “Harvest” while in the add-on) to easily pull up most of these sample requests.
Part 6: Handle Filtering
You may want to limit your pulls for certain client IDs or time ranges. 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).
If you don’t need all the fields returned by Harvest, click Edit Fields before you run your request. This will open API Connector’s visual field editor, where you can choose the columns you’d like to display in your sheet.
Part 7: 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’ 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:
- API URL: enter your request URL
- Pagination type:
next page URL
- Next page path:
- Run until: choose when to stop fetching data
Part 8: Fetch New Data Only
You may want to fetch new data only rather than repeatedly retrieve data you already have in your sheet. Harvest provides various time parameters we can use for this purpose.
Here’s one way to apply these to your request:
- Fetch existing data into a sheet (let’s call it TimeEntries), and find the column containing your spent date.
- Create a second sheet called MaxDate and input this formula:
- That formula grabs the most recent spent date, and converts it to yyyy-mm-dd format. Update your time entries API request to reference that cell, like this:
- Run that request in append mode, sending to the same TimeEntries sheet. Now, whenever you run this request, data with new spent dates will append to the end of your existing data.
Part 9: 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: