Connect Excel and Google Sheets to the Data API
Last updated · View as markdown
You can pull data from the AMMP Data API straight into Excel or Google Sheets for your own analysis and reports, and refresh it on demand. You'll need an API key; see User management.
To query AMMP data from an AI assistant instead, see AMMP MCP server.
Excel
There are two ways to connect: start from an AMMP template, or add the AMMP queries to an existing workbook. A video walkthrough shows the template route.
Using the AMMP template
- Ask support@ammp.io for the latest template. There are templates for different data, such as historic energy or power; the matching endpoints are listed in the Data API docs.
- Open the template, and click Enable Editing and Enable Content.
- Go to Data → Get Data → Query Options → Current Workbook (Privacy) and select Ignore privacy levels, so Excel can fetch external data.
- Click Launch Power Query Editor.
- Under Input Parameters, open Enter your API key and paste your key.
- Set the start date in Date From (
yyyy-MM-dd). In the power template, use Enter Starting Time (yyyy-MM-dd hh:mm:ss, with a space before the time). - Set the end date in Date To the same way.
- Set Interval:
1dfor daily or1Mfor monthly energy;1hor15min the power template. - Click Refresh All. Your assets load into Step 5: Select the Assets. If a yellow bar with Edit credentials appears, click it and then Connect.
- To use only some assets, filter the
asset_idcolumn. - Check the result under Output → Output.
- Click Close & Load, then Data → Queries & Connections.
- Right-click Output and choose Load To… to put the data on a sheet.
Troubleshooting
- Firewall error: repeat step 3 (Ignore privacy levels).
- No assets shown: in Power Query, switch on View → Query Settings, select Step 5: Select the Assets, and delete any Filtered Rows step under Applied Steps.
- Updating the period: open Data → Queries & Connections, double-click the parameter, change it, click Close & Load, then click Refresh All twice (two separate clicks).
Adding AMMP data to an existing workbook
- Open your workbook and the AMMP template, and launch the Power Query Editor in both.
- Copy all queries from the template and paste them into your workbook's query list.
- Continue from step 2 of the template instructions.
Google Sheets
Google Sheets has no template, because each user installs the API add-on themselves.
- Install the SyncWith | Any API add-on, then open Extensions → SyncWith | Any API → Launch sidebar.
- Choose Custom at the bottom of the list.
- Create a
POSTrequest to the Data API's token endpoint (see the Data API docs) with two headers:accept: application/jsonandx-api-key: <your API key>. - Click Preview to check it returns a token, then Insert it into the first sheet.
- Create further requests for the endpoints you need, using cell references for the token and query parameters. See SyncWith's guide to cell references.
Tip
A cell reference that points to a range, such as a column of asset IDs, makes one API call per cell. That's an easy way to pull data for many assets at once.
You can also schedule refreshes. Tokens expire, so make sure the schedule refreshes the token request before the data requests.
