Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
sbenzaquen
Helper I
Helper I

Connecting Harvest API with PowerBI

Hi,

 

I'm trying to connect Harvest and a PowerBI dashboard through an API. I managed to connect the data through a web connection and pass the credentials stage,  however, only 100 rows/1 page of data is retrieved when actually the specified period covers multiple pages. How can I retrieve more pages?

 

I found a very relevant article that explains this issue thoroughly, but my relatively short PowerBI experience limits me to know how to apply it. Where are these functions entered? I'd highly appreciate if someone could walk me over this in more detail than the article.

 

https://datachant.com/2016/06/27/cursor-based-pagination-power-query/

 

Thank you,

Salvador

7 REPLIES 7
sanderallert
Regular Visitor

There's an App on the AppSource that allows you to connect to your Harvest data from Power BI. Here's the link: Harvest Reporting

This may be a good example to get started? 

JOC_DRA
New Member

Thank you both for this you saved me.  I want to share my code too if it is hopeful for anything--- which is nearly the same as the previous poster:

 

BaseURL = "https://api.harvestapp.com/v2/projects?access_token=#######.pt.XXXXXXXXXXXXXXXXXX&account_id=######",
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i44FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Changed Type" = List.Numbers(0,10,100),
#"Converted to Table" = Table.FromList(#"Changed Type", Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Changed Type1" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each Json.Document(Web.Contents((BaseURL&"limit=100"&[Column1]))))

mahoneypat
Microsoft Employee
Microsoft Employee

Please see if this video helps - Power BI - Tales From The Front - REST APIs - YouTube

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thank you @mahoneypat . This is useful but when adding the custom column the following error gets prompt 

 

Expression.Error: We cannot convert a value of type List to type Table.
Details:
Value=[List]
Type=[Type]

 

What can I do to fix it?

 

Thanks,

Salvador

Can you share your M code from the Advanced Editor and/or an example of what your data look like at the step before the error?

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thanks @mahoneypat . Here is the code:

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i44FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Changed Type" = List.Numbers(0,10,100),
#"Converted to Table" = Table.FromList(#"Changed Type", Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Added Custom" = Table.AddColumn(#"Converted to Table", "Custom", each Table.AddColumn(#"Changed Type", "Custom",each Json.Document(Web.Contents(BaseURL&"100"&[Column1]))))
in
#"Added Custom"

 

Current Value of "BaseURL": "https://api.harvestapp.com/v2/time_entries?from=" & "2021-01-01&to=2021-07-31"&"access_token=184XXXX&account_id=105XXXX"

Two issues I saw.

 

1. You were missing a & in your BaseURL

2. Your Added Custom step was referencing the Changed Type step but should have pointed to the Converted to Table step.

 

Here is some updated code that seems to work.

 

let
BaseURL = "https://api.harvestapp.com/v2/time_entries?from=" & "2021-01-01&to=2021-07-31"&"&access_token=184XXXX&account_id=105XXXX",
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i44FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Changed Type" = List.Numbers(0,10,100),
#"Converted to Table" = Table.FromList(#"Changed Type", Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Changed Type1" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each Json.Document(Web.Contents(BaseURL&"100"&[Column1])))
in
#"Added Custom"

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors