JSON to Google Sheets: Import, Parse, and Automate

Learn how to import JSON data into Google Sheets, parse nested structures, and set up automatic refreshes. This practical guide covers Apps Script, custom functions, and add-ons for reliable JSON workflows in Google Sheets.

How To Sheets
How To Sheets Team
·5 min read
Quick AnswerSteps

By the end of this guide, you will be able to pull JSON data into Google Sheets, parse nested objects, and refresh automatically. You can fetch JSON from URLs or local sources and choose between Apps Script, built-in tooling, or third-party add-ons. This step-by-step approach covers common JSON shapes and practical templates to keep data up-to-date in Sheets.

What you will learn about json to google sheets

This guide teaches practical, repeatable methods to move JSON data into Google Sheets, then transform it into a clean, editable table. You will understand when to use Apps Script, custom functions, or add-ons, and how to handle common JSON shapes like arrays of objects or nested fields. The goal is to give you a reliable workflow you can reuse for financial reports, project dashboards, or inventory data. Throughout, the How To Sheets team emphasizes clear mapping between JSON keys and sheet columns, and how to maintain data integrity as sources update.

JSON data shapes you’ll encounter and how they map to sheets

JSON data can arrive in flat objects, arrays of objects, or deeply nested structures. A flat object like {"name":"Alex","age":30} maps cleanly to a two-column header, but nesting requires flattening or creating multi-level headers. Arrays, such as [{"id":1,"score":95},{"id":2,"score":88}], translate to repeated rows. Understanding these patterns helps you decide whether to normalize data in a single pass or build multiple worksheets for different layers of detail.

Three practical approaches to bring JSON into Google Sheets

  1. Apps Script: fetch JSON, parse with JSON.parse, and write values to a sheet. This is powerful for complex data and automated refreshes. 2) Custom functions or add-ons: use a ready-made or self-written function to pull and flatten data directly in cells. 3) Third‑party tools: data connectors and import add-ons can simplify the workflow when you’re short on time or need a plug‑and‑play solution. Each method has trade-offs in flexibility, learning curve, and reliability.

Approach 1: Apps Script—fetch, parse, and map

Apps Script lets you write JavaScript to fetch a JSON URL, parse the response, and map keys to sheet columns. Start by creating a function that uses UrlFetchApp.fetch(url) and JSON.parse(). Then build a mapping layer that converts nested structures into a flat, tabular format. Finally, write values with sheet.getRange(row, col).setValues(data). Apps Script is ideal when you need dynamic refreshes or custom data shaping, but it requires some coding effort.

Approach 2: Custom functions and add-ons

For simpler tasks, a custom function like =IMPORTJSON(url, path) (or a similarly named library function) can pull data and reveal it directly in a worksheet. These approaches reduce scripting, but may impose limits on data size and complex nesting. Add-ons from the Google Workspace Marketplace offer pre-built JSON parsers and templates. They’re convenient for quick wins and for users who prefer a GUI over code.

Approach 3: Third-party tools and data connectors

Dedicated tools can automate JSON imports, flatten deeply nested data, and schedule updates without writing code. Look for connectors that support REST APIs, pagination, and incremental updates. While these tools simplify setup, they introduce dependency on third-party services and may involve costs. Always review access scopes and data privacy policies before connecting sensitive JSON data.

Step-by-step workflow to import JSON from a URL (high level)

This practical workflow covers the essential moves: identify the data source, fetch JSON, normalize structure, map to headers, insert rows, and test with a sample. Build a repeatable template in Sheets and, if needed, attach a simple Apps Script trigger to refresh on a schedule. The key is to model the target table first, then implement the retrieval logic to match that shape.

Flattening nested JSON into a flat table

Flattening requires deciding how deep to go and how to represent arrays as rows. Common techniques include using dot notation for nested keys (e.g., address.city) and expanding arrays into separate rows with an index column. In Apps Script, you can write recursive functions to traverse objects and build a two-dimensional array that fits your headers. This ensures the final sheet remains readable and easy to filter.

Best practices for reliability, performance, and refresh

Prefer batching writes instead of cell-by-cell updates to reduce API calls. Cache results where possible, especially for large responses, and implement basic error handling (try/catch) with meaningful logs. When refreshing data, consider triggers for daily or hourly updates while respecting rate limits. Document your data schema in a separate sheet so future changes don’t break the mapping.

Real-world examples and templates to get started

You’ll find templates that demonstrate a simple REST API returning a list of products, with fields like id, name, price, and stock. Another template shows a nested object for user profiles, flattened into a clean table with header rows. These examples illustrate how to approach different JSON shapes and how to adapt them to your reporting needs.

Tools & Materials

  • Google account(Access to Google Sheets and Apps Script environment)
  • Web browser(Chrome or modern browser for best experience)
  • JSON data source URL or file(Public or authenticated API endpoint; ensure CORS if needed)
  • Google Apps Script editor(Accessed from Extensions > Apps Script in Sheets)
  • Optional: JSON parsing add-on or library(Provides GUI-based parsing or prebuilt functions)
  • Sample JSON dataset(For practice and testing before live data)

Steps

Estimated time: 45-75 minutes

  1. 1

    Identify source and target schema

    Clarify where the JSON data comes from and what the final sheet should look like. Decide which fields map to which columns, and determine how to handle nested data or arrays.

    Tip: Write a quick mock of the final table to guide parsing logic.
  2. 2

    Open Apps Script editor and create a function

    In Sheets, go to Extensions > Apps Script, create a new project, and define a function that fetches JSON from a URL or local source. This sets the core data pipeline.

    Tip: Comment your code early to document the intended data shape.
  3. 3

    Fetch and parse JSON data

    Use UrlFetchApp.fetch(url) and JSON.parse() to convert the response into a JavaScript object. Validate the structure with console logs during development.

    Tip: Log key fields to verify the payload shape before mapping.
  4. 4

    Normalize the data into a 2D array

    Create a function that flattens nested properties into a flat row per item, aligning values with your header order. Return a 2D array suitable for setValues.

    Tip: Build a header array first, then push rows in the same order.
  5. 5

    Write data to the sheet

    Clear the target range and write the headers followed by the data rows using setValues. Ensure the number of columns matches your header row.

    Tip: Use batch writes to improve performance and reduce API calls.
  6. 6

    Set up an automatic refresh

    Create a time-driven trigger (e.g., hourly or daily) to re-fetch and rewrite data. This keeps your sheet up-to-date with minimal manual work.

    Tip: Always implement error handling and alerting in the trigger function.
Pro Tip: Test JSON with a REST client or curl to confirm structure before coding in Apps Script.
Warning: Respect API rate limits; implement backoff if you hit limits or errors.
Note: Use named ranges for headers to simplify updates and maintenance.

FAQ

Can Sheets parse JSON directly without scripting?

Google Sheets does not include a built-in JSON parser. For JSON data, you typically use Apps Script, a custom function, or a third-party add-on to fetch, parse, and display the data in a sheet.

Sheets needs a script or add-on to read JSON data because there isn’t a built-in JSON parser.

What is the simplest method for a single JSON URL?

The easiest approach is to use Apps Script to fetch the URL, parse the JSON, and write the results to the sheet. This provides control and avoids manual work.

Use Apps Script to fetch and parse the JSON, then write to the sheet.

How often should I refresh the JSON data?

Refresh frequency depends on how up-to-date you need the data. Time-driven triggers in Apps Script can automate daily or hourly updates, subject to API limits.

Set a regular refresh with a time trigger to keep data fresh.

Are there privacy risks when importing JSON into Sheets?

Be mindful of what data you expose via Sheets sharing settings. Avoid storing sensitive data in shared sheets unless access is strictly controlled.

Guard sensitive data with proper sharing controls and permissions.

Do I need JavaScript knowledge to parse JSON with Apps Script?

Basic JavaScript familiarity helps because Apps Script uses JavaScript syntax. You can still copy patterns and adapt examples for common JSON shapes.

Some JavaScript knowledge helps, but you can learn as you go.

Can I import nested JSON into a flat table?

Yes. Flattening requires mapping nested keys to a flat header set and expanding arrays into rows. Apps Script can automate this transformation.

Flatten nested data using a mapping strategy and scripts.

Watch Video

The Essentials

  • Map JSON keys to sheet columns clearly.
  • Choose Apps Script for flexibility and automation.
  • Flatten nested data to a readable, filterable table.
  • Set up scheduled refreshes to keep data current.
  • Validate data at every step to avoid silent errors.
Process diagram showing fetch, parse, and render steps for JSON to Google Sheets
A simple three-step process to move JSON data into Google Sheets

Related Articles