Import Harvest Data to Google Sheets

Import Harvest Data to Google Sheets

Comments:15

  1. Great help, pulls data in! Is it possible to set a data range of the data pulled in however, i’m unclear how much data this is pulling

    1. Most of Harvest’s API responses sort by recency (e.g. the ‘spent_date’ or ‘created_at’ fields) and are limited to 100 records. You can see the specific default sort field in the documentation, but generally this means that if you run a Harvest API query without any parameters, it will return most recent 100 records. If you wanted to get data for, say, February, you’d add parameters like https://api.harvestapp.com/v2/time_entries?from=2019-02-01&to=2019-02-28

  2. I’m getting a “Failed to run request” error when coping the above (but with my token info).
    Can you explain what “Bearer” in the Authorization key is for?

    1. Hi Shawn, the string “Bearer” is required by Harvest, you can see this in the screenshot under step #4 (under “Testing your Token”). More generally, “Bearer” authentication is an HTTP authentication scheme.
      If you’re still having trouble feel free to email over a screenshot and I’ll take a look.

  3. The user agent actually doesn’t really matter, Harvest just wants a way to contact you if necessary. So you could use either email and it wouldn’t make a difference.

    Your headers look correct, though there’s some weird artifact visible next to Harvest-Account-Id. So please verify that a) there are no spaces or other extra characters around the URL or headers, and b) that your Harvest account ID & authorization value are correct.

    You can also troubleshoot by trying your request in a different online API tool like https://inspector.swagger.io/builder. Then, if it still doesn’t work, you’ll know the issue is that your header values are incorrect, and if it does work, you can just copy and paste your setup from there into API Connector.

  4. Hello my data got pulled in, but it didn’t pull in Header information to the Gsheet, and some fields that are text , are showing as numbers. Can you help me ?

    1. Can you please click the ‘Output Options’ button and check what mode you’re in? Overwrite mode will print out headers, while Append mode won’t (info).
      As for fields showing up as numbers instead of text, formats are automatically assigned by Google based on its best guess of what the data is. If it has guessed incorrectly, please try changing the format using Sheets built-in format functions. You can also create a new sheet where you assign the correct data formats to each column, and then populate those columns by querying your API data sheet (e.g. =QUERY(Harvest!A:Z, “select A, B,C”)

  5. Hi.
    I can’t use a token at harvest because my client prefer the authentication by using email&password.

    client = harvest.Harvest(f”https://{account}.harvestapp.com”, email, password)
    client.who_am_i

    My client wants to make an arbitrary query to the harvest API to get a report on how the user spent their time.
    But in that case, I don’t find any solution in harvest API v2 documentation.
    Please help me with this problem.

    Kind regards.
    Mark.

    1. Sorry, I don’t think I can help you here, since as you found in the documentation, Harvest V2 API only provides 2 methods of authentication, and neither involves email & password. However you can check the V1 version of their API, I’m not really familiar with that but a quick scan shows it uses Basic Authentication, which basically means encoding your email address and password to base64 and adding it to a header. Maybe that works for you? (V1 documentation).

  6. Hello,

    I created a new tab/sheet and when the sheet is selected I click ‘Set’ and I get

    ScriptError: Authorization is required to perform that action.

    Do you know what I need to fix here? I have written out the three headers according to your format. I don’t see any issues there or with the API URL.

    Any ideas? I appreciate your help.

      1. Hello Ana, Thank you for the prompt reply. What I’m trying to do is get the Time Entries with the Tasks name “Admin”. Did try to add the parameters after the URL name=Admin and still it doesn’t work. Can youp please help?

      2. If you’re looking to filter the time_entries endpoint, you need to use the task_id parameter, like this: https://api.harvestapp.com/v2/time_entries?task_id=YOUR_TASK_ID, where you substitute in your own task ID. If you don’t know your task ID, you can find it by querying the endpoint https://api.harvestapp.com/v2/tasks/.

Leave a Reply

Your email address will not be published.