Skip to content

Latest commit

 

History

History
45 lines (29 loc) · 1.44 KB

File metadata and controls

45 lines (29 loc) · 1.44 KB

Custom Function (Google Sheets) to Import FRED® Economical Data

This product uses the FRED® API but is not endorsed or certified by the Federal Reserve Bank of St. Louis.

1. What's FRED®?

https://fred.stlouisfed.org/docs/api/fred/fred.html

2. Setup

2.1. Create a custom function in Google Sheets

https://developers.google.com/apps-script/guides/sheets/functions

2.2. Request an API-Key

https://fred.stlouisfed.org/docs/api/fred/#API

2.3. Modify the function to use your API-Key for requests

Change the variable api_key to your API-Key (32 character lower-cased alpha-numeric string)

var api_key = 'abcdefghijklmnopqrstuvwxyz123456';

3. Examples

3.1. Get the newest value (Gross Domestic Product, Series-ID = GDP):

=fredDATA("GDP",0)

grafik

3.2. Get all historical values (Unemployment Rate, Series-ID = UNRATE):

=fredDATA("UNRATE",1)

grafik

4. Use Case ("Buffett-Indicator" - Stock Market Capitalization-to-GDP Ratio)

=query(fredDATA("WILL5000PR",0),"select Col2 offset 1",0)*1.05/QUERY(fredDATA("GDP",0),"select Col2 offset 1",0)