How to Import JSON Data from an API into a Google Sheet

Antoine Vulcain
learn-finance
Published in
2 min readMay 15, 2020

For this example we will be using https://fmpcloud.io/ ( stocks and financial API) and google sheet (https://www.google.com/sheets/about/).

We will demonstrate how easy it is to integrate their API into Google Sheets for accessing and keeping track of Apple Inc. price and financial statements.

Let’s get into it:

a. Create a new Google Sheet

b. Select Tools then click on Script Editor

c. Delete the content of Code.gs

d. copy this script: https://gist.githubusercontent.com/paulgambill/cacd19da95a1421d3164/raw/047b04a1c321b697533adad5828e6df8748b5e54/import_json_appsscript.js in the Code.gs

d. Paste it into the Code.js

e. Rename your code “ImportJSON”

f. You can now go back to your google Sheet

g. In A1 type =IFERROR(IMPORTJSON(“https://fmpcloud.io/api/v3/quote/AAPL/?apikey=demo", “/”, “noHeaders”), IMPORTJSON(“http://fmpcloud.io/api/v3/quote/AAPL/?apikey=demo", “/”, “noHeaders”))”))

h. Or for financials you can type in A1: =IFERROR(IMPORTJSON(“https://fmpcloud.io/api/v3/income-statement/AAPL/?apikey=demo", “/”, “noHeaders”), IMPORTJSON(“http://fmpcloud.io/api/v3/income-statement/AAPL/?apikey=demo", “/”, “noHeaders”))”))

h. you can now replace the API key demo by your API key and query other stocks and any endpoints on their documentation.

--

--