Skip to content
Google Sheets integration

Use FXMacroData in Google Sheets

Pull macroeconomic indicators, FX rates, commodities, release calendars, and catalogue metadata into spreadsheet cells with Apps Script custom functions or the FXMacroData sidebar importer.

Sheets workflows

Use custom functions for live spill ranges or the sidebar for static tables and optional charts in your research workbook.

Auth model

Catalogue metadata is free for every supported currency. USD indicators and calendars can run without a key; a saved paid key also applies to USD requests. FX rates, commodities, and non-USD data require a paid key.

Data shape

Functions return spill ranges. The sidebar importer writes the same tabular data into the selected output range.

Connect your spreadsheet

1. Open the sidebar

With FXMacroData enabled in your spreadsheet, choose Extensions > FXMacroData > Open sidebar. Use Authorize add-on from the same menu when Google requests permission. Start with a keyless USD indicator or a catalogue lookup for any supported currency.

2. Save an API key for paid access

Sign in to FXMacroData, create a key in API management, paste it in the sidebar, and click Save, then Test. The key is saved in Apps Script user properties and the sidebar's browser local storage. Use Clear saved key to remove saved copies in this browser and script account. Keep keys out of sheet cells and screenshots.

3. Use formulas

Enter a formula in an empty cell and leave space for its rows and columns. A saved paid key enables paid access for USD as well as protected datasets. Without a key, USD data uses the Always Free 90-day window, 15-minute publication delay and daily request limit.

=FXMACRO_INDICATOR("usd","inflation")
=FXMACRO_CATALOGUE("eur")
=FXMACRO_INDICATOR("eur","inflation","2024-01-01")
=FXMACRO_COMMODITY("gold","2024-01-01")

Protected live formulas use the spreadsheet owner's saved key. Collaborators should import static tables from the sidebar using their own keys. To recalculate existing formulas, choose Extensions > FXMacroData > Refresh FXMacroData formulas.

4. Import from the sidebar

Select an empty cell, choose the dataset and options, and click Import selected data to write a static table. Choose Insert live formula for a refreshable formula. Leave Overwrite occupied output cells unchecked to protect existing values. Enable the chart option for supported date-and-value series.

5. Direct HTTP access

In your own Apps Script code, send the key in the X-API-Key request header with UrlFetchApp.

UrlFetchApp.fetch("https://api.fxmacrodata.com/v1/announcements/eur/inflation", {
  headers: { "X-API-Key": PropertiesService.getUserProperties().getProperty("FXMACRODATA_API_KEY") }
});

Use Apps Script for protected requests so the API key stays in the request header. Built-in IMPORTDATA cannot set that header.

For your own bound-script setup, open Extensions > Apps Script, add the FXMacroData Code.gs and Sidebar.html files, and enable the project manifest to add appsscript.json. Save and reload the spreadsheet. Contact info@fxmacrodata.com for the script files and setup support.

Read the Google Sheets privacy information for spreadsheet permissions, API requests, saved keys and deletion choices.

Custom functions

Each function returns a table. Indicator, FX, and commodity functions auto-page API responses in batches of 100 rows up to the requested row cap.

Calendar rows preserve date-only releases and identify the time as unannounced, using the publisher's local date. Exact calendar times are labelled UTC. Use the catalogue to find valid indicator slugs for the selected currency.

Function Purpose Example
FXMACRO_INDICATOR Macro indicator time series such as inflation, GDP, unemployment, and policy rates. =FXMACRO_INDICATOR("usd","inflation")
FXMACRO_FOREX FX spot-rate history for currency pairs. =FXMACRO_FOREX("eur","usd","2024-01-01")
FXMACRO_COMMODITY Commodity and energy series such as gold, WTI oil, Brent oil, and natural gas. =FXMACRO_COMMODITY("gold")
FXMACRO_CALENDAR Upcoming economic release dates for a currency. =FXMACRO_CALENDAR("usd")
FXMACRO_CATALOGUE Available indicator slugs and metadata for a currency, free without a key for every supported currency. =FXMACRO_CATALOGUE("aud")

API endpoints behind the formulas

Apps Script calls the same production API documented on this site. Protected endpoints need your API key.

https://api.fxmacrodata.com/v1/announcements/usd/inflation
https://api.fxmacrodata.com/v1/forex/eur/usd
https://api.fxmacrodata.com/v1/commodities/gold
https://api.fxmacrodata.com/v1/calendar/usd
https://api.fxmacrodata.com/v1/data_catalogue/usd

Header: X-API-Key: YOUR_API_KEY

For direct list requests, the API defaults to 20 rows and accepts limit up to 100. Continue with offset until pagination.has_more is false.

Sheets workflow options

Use custom functions for repeatable refreshes, sidebar imports for static table loads, or your own Apps Script for custom API requests. Start with a small row cap and increase it as needed; larger imports can take longer under Google's execution limits.

Keep API keys in user-scoped script properties or your own secret manager rather than shared cells. For support, contact info@fxmacrodata.com.

Related docs

AI Answer-Ready

Key Facts

Page
Google Sheets
Section
Documentation
Canonical URL
https://fxmacrodata.com/documentation/google-sheets
Source
FXMacroData editorial and official publisher references
Last Updated
See page metadata

Provenance And Trust

Cite the canonical URL and source field above. Where available, this page maps to official publisher releases and timestamped updates.

Quick Q&A

What is this page about? This page explains Google Sheets with directly usable context for trading, research, and API workflows.

What source should be cited? Use the canonical URL and the listed source field; cite official publisher references when available.

How fresh is this content? The last updated value above reflects the page metadata or latest available data timestamp.

Can this be used in AI assistants? Yes. This section is intentionally structured for retrieval and citation in chat assistants.

Prompt Packs

Use these in ChatGPT, Claude, Gemini, Mistral, Perplexity, or Grok for consistent source-aware outputs.

Share page X LinkedIn Email