Connect Harlo to Excel and Power BI
Bring Harlo data into Excel or Power BI with Power Query, and refresh it with one click or on a schedule.
You'll need
- A Harlo admin login
- Excel for Microsoft 365 or Excel 2016 and later (Windows or Mac), or Power BI Desktop
Quick: one page, no code
- Make a Harlo API key. In Harlo, open Settings, API keys, choose Create API key, name it Excel, and copy it. You'll paste it in a moment; Harlo shows it only once.
- In Excel choose Data, Get Data, From Other Sources, From Web, then Advanced.
- URL parts:
https://harlo-api-dev.pages.dev/v1/invoices?format=csv&limit=100. Under HTTP request header parameters typeAuthorizationon the left andBearer hk_…on the right. Choose OK, and Anonymous if Excel asks how to connect (the key is already in the header). - Choose Load. Data, Refresh All updates it.
This brings the newest 100 records. For everything, use the query below.
Every record, with Power Query
- Data, Get Data, Launch Power Query Editor. Choose Home, Manage Parameters, New Parameter: name
HarloApiKey, type Text, current value your key. - Home, New Source, Blank Query, then Advanced Editor. Paste:ChangePower Query M
let // Your key goes in a parameter (Home > Manage Parameters > New), named HarloApiKey. Resource = "invoices", GetPage = (cursor as nullable text) => Json.Document( Web.Contents( "https://harlo-api-dev.pages.dev/v1", [ RelativePath = Resource, Query = [limit = "100"] & (if cursor = null then [] else [cursor = cursor]), Headers = [Authorization = "Bearer " & HarloApiKey] ] ) ), Pages = List.Generate( () => GetPage(null), each _ <> null, each if [has_more] then GetPage([next_cursor]) else null ), Records = List.Combine(List.Transform(Pages, each [data])), Result = Table.FromRecords(Records, null, MissingField.UseNull) in ResultResourceto readloads,payments,customersor any other list. - Choose Done. Columns holding a record (like
customer) have an expand button in their header: pick the fields you want. Then Close & Load. - If Excel asks for credentials for the API, choose Anonymous.
Power BI
The same query works in Power BI Desktop (Get Data, Blank Query). Because the base URL is fixed and the rest goes in RelativePath and Query, the Power BI service can refresh it on a schedule: after publishing, open the dataset's settings, set the data source credentials to Anonymous, and turn on scheduled refresh.
Sharing the workbook
The key is saved in the workbook's parameter. Anyone you send the file to can read it. Share the report, not the workbook, or make a separate key for it and revoke it when no longer needed.