LoadLane — URL to SheetsGoogle Sheets™ add-on · Import now free · Pro $4.99/mo · Version 1.0Read the setup guide

How to import JSON or an API into Google Sheets

Updated 12 November 2026 · 6 min read

Short answer: Google Sheets can import a CSV or TSV file from a web address with =IMPORTDATA(url), and XML or web-page tables with IMPORTXML and IMPORTHTML. It has no function for JSON, and none of these can send an API key in a header or run on a timetable you choose. The free way around both is a short Apps Script: UrlFetchApp requests the API with your key, JSON.parse reads the answer, setValues writes the rows, and a time-driven trigger runs it every hour. An add-on such as LoadLane does the same without code, and adds a column picker, pages, Append and Snapshot.

1. What Google Sheets can do by itself

What all the formulas leave out:

For JSON, for an API that wants a key in a header, or for a refresh on a timetable, you write a script or use an add-on.

2. The Apps Script way: an API with a key, into a tab

  1. In your spreadsheet, choose Extensions → Apps Script.
  2. Keep the key out of the code. Paste this function, put your key in it, click Run once, then delete the key from the code again. It stores the key in your own user properties, which other editors of the script cannot read.
    function saveToken() {
      PropertiesService.getUserProperties().setProperty('API_TOKEN', 'paste-your-token-here');
    }
  3. Add the import itself. Change the address, the path to the list (data.items here), the columns and the tab name, and click Save.
  4. Click Run on importOrders. The first time, Google asks you to allow the script to see your spreadsheets and connect to an external service. Then look at the tab.
function importOrders() {
  const token = PropertiesService.getUserProperties().getProperty('API_TOKEN');
  const res = UrlFetchApp.fetch('https://api.example.com/v1/orders?limit=250', {
    headers: { Authorization: 'Bearer ' + token },
    muteHttpExceptions: true
  });
  if (res.getResponseCode() !== 200) {
    throw new Error('HTTP ' + res.getResponseCode() + ': ' + res.getContentText().slice(0, 200));
  }
  const items = JSON.parse(res.getContentText()).data.items;   // the list you want
  const cols = ['id', 'status', 'total'];                       // the fields you want
  const rows = items.map(item => cols.map(c => item[c] ?? ''));
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Orders');
  sheet.clearContents();
  sheet.getRange(1, 1, rows.length + 1, cols.length).setValues([cols, ...rows]);
}

For a CSV address, replace the JSON.parse line with Utilities.parseCsv(res.getContentText()), which already gives you rows.

3. Make it run on a schedule

  1. In the Apps Script editor, click Triggers (the clock icon on the left), then Add Trigger.
  2. Choose the function importOrders, the event source Time-driven, the type Hour timer and Every hour.
  3. Click Save.

From then on Google runs the script every hour, while the spreadsheet is closed. A Day timer imports daily and a Week timer weekly. The trigger can also be made in code: ScriptApp.newTrigger('importOrders').timeBased().everyHours(1).create().

4. Where the simple script falls short

None of this is hard on its own. Together, it is a small program to keep up every time someone needs one more feed.

5. With an add-on: LoadLane

LoadLane is our Google Sheets™ add-on for this job. It does what the script above leaves to you:

How to set it up: LoadLane help.

LoadLane — URL to SheetsAPI and JSON imports on a schedule, without a script.
Read the setup guide

Questions

Is there an IMPORTJSON function in Google Sheets?

No. Google Sheets has IMPORTDATA for CSV and TSV, and IMPORTXML, IMPORTHTML and IMPORTFEED for XML, web pages and feeds, but no function for JSON. The ImportJSON you may find online is a script you paste into Apps Script yourself, not a Google function.

How do I send an API key with IMPORTDATA?

You cannot send a header with IMPORTDATA. It only works if the API accepts the key as a parameter in the address, and then the key is in the formula, where everyone who can open the spreadsheet can read it.

Can I choose how often IMPORTDATA refreshes?

No. Google Sheets decides when to fetch the address again. For a fixed timetable, such as every hour or every Monday at 8 AM, use an Apps Script with a time-driven trigger, or an add-on.

Can a script import an API while the spreadsheet is closed?

Yes. A time-driven trigger runs the script on Google’s servers every hour, day or week, whether the spreadsheet is open or not.

RelatedLoadLane: import CSV, JSON and APIs into Google SheetsLoadLane helpAPI keys, parameters and headers