Google Spreadsheet Code Example

Using the awesome ImportJSON tool in combination with this wonderful script, you are able to get the GuruFocus API data into a google spreadsheet in a matter of minutes. Here’s how:

  1. Create a new Google Spreadsheet.
  2. Click on Tools -> Script Editor.
  3. Click Create script for Spreadsheet.
  4. Delete the placeholder content and paste the code from this script.
  5. Rename the script to ImportJSON.gs and click the save button.
  6. Back in the spreadsheet, in a cell, you can type “=ImportJSON()” and begin filling out it’s parameters.

For example, if you want to use GuruFocus API to get valuation ratios in Google Spreadsheet, just try the following function in your spreadsheet

=ImportJSON(("https://api.gurufocus.com/public/user/{api_token}/stock/AAPL/keyratios"), "/Valuation", "")

The output will be:

Output