Use FXMacroData in Google Sheets
Pull macroeconomic indicators, FX rates, commodities, release calendars, and catalogue metadata into spreadsheet cells with Apps Script custom functions, a sidebar importer, or direct production API URLs.
Sheets workflows
Use Apps Script custom functions, sidebar importers, or direct API URLs to bring FXMacroData records into shared research workbooks.
Auth model
USD indicator, catalogue, and calendar examples can run without a key. Non-USD and protected endpoint families use a key saved from the sidebar.
Data shape
Functions return spill ranges. The sidebar importer writes the same tabular data into the selected output range.
How a user connects the API today
1. Create an API key
Sign in to FXMacroData, open API management, and generate a key for the account or subscription.
2. Save it in Sheets
In your own Apps Script project, store the key in user-scoped script properties. Keep it out of shared sheet cells and screenshots.
3. Use formulas
Start with public USD and FX formulas, then use the saved key for non-USD indicators and commodities.
=FXMACRO_INDICATOR("usd","inflation")
=FXMACRO_INDICATOR("eur","inflation","2024-01-01")
=FXMACRO_COMMODITY("gold","2024-01-01")
4. Import from the sidebar
Select an empty cell, open the FXMacroData sidebar, choose a dataset, and click Insert at selected cell to write a static table.
5. Direct HTTP access
The same key works as an api_key query parameter for direct formulas, scripts, and browser smoke tests.
https://api.fxmacrodata.com/v1/announcements/eur/inflation?api_key=YOUR_API_KEY
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.
| 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. | =FXMACRO_CATALOGUE("aud") |
API endpoints behind the formulas
Apps Script calls the same production API documented on this site.
https://api.fxmacrodata.com/v1/announcements/usd/inflation?api_key=YOUR_API_KEY https://api.fxmacrodata.com/v1/forex/eur/usd?api_key=YOUR_API_KEY https://api.fxmacrodata.com/v1/commodities/gold?api_key=YOUR_API_KEY https://api.fxmacrodata.com/v1/calendar/usd?api_key=YOUR_API_KEY https://api.fxmacrodata.com/v1/data_catalogue/usd
Sheets workflow options
Use custom functions for repeatable refreshes, sidebar imports for analyst-friendly table loads, or direct API calls when you want transparent formulas.
Keep API keys in user-scoped script properties or your own secret manager rather than shared cells. For support, contact info@fxmacrodata.com.