{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["img","callout","faq","faq-item","partial"]},"type":"markdown"},"seo":{"title":"Import data into a Google Sheet","description":"Bring spreadsheets, data files, and JSON API data into a Google Sheet, and see what to do when native import options fall short.","siteUrl":"https://help.databox.com","llmstxt":{"title":"Databox Knowledge Base","description":"Databox is a business analytics platform that consolidates data in one place, enabling real-time performance tracking and insights by mixing and matching data from various sources for a comprehensive view.","details":{"content":"This knowledge base covers everything from account setup and integrations to building Databoards, creating custom metrics, and using AI-powered features."},"sections":[{"title":"General","includeFiles":["docs/general/*.md","docs/general/visualization-types/*.md","docs/general/templates/*.md"],"excludeFiles":[]},{"title":"AI","includeFiles":["docs/ai/*.md"],"excludeFiles":[]},{"title":"Account Management","includeFiles":["docs/account-management/**/*.md"],"excludeFiles":[]},{"title":"Databoards","includeFiles":["docs/databoards/**/*.md"],"excludeFiles":[]},{"title":"Data Management","includeFiles":["docs/data-management/**/*.md"],"excludeFiles":[]},{"title":"Metrics","includeFiles":["docs/metrics/**/*.md"],"excludeFiles":[]},{"title":"Forecasts","includeFiles":["docs/forecasts/*.md"],"excludeFiles":[]},{"title":"Goals","includeFiles":["docs/goals/*.md"],"excludeFiles":[]},{"title":"Reports","includeFiles":["docs/reports/*.md"],"excludeFiles":[]},{"title":"Notifications","includeFiles":["docs/notifications/*.md"],"excludeFiles":[]},{"title":"Pricing and Billing","includeFiles":["docs/pricing-and-billing/*.md"],"excludeFiles":[]},{"title":"Mobile","includeFiles":["docs/mobile/*.md"],"excludeFiles":[]},{"title":"Support","includeFiles":["docs/support/*.md"],"excludeFiles":[]},{"title":"Integrations","includeFiles":["docs/integrations/**/*.md"],"excludeFiles":[]}],"hide":false,"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"import-data-into-a-google-sheet","__idx":0},"children":["Import data into a Google Sheet"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Google Sheets can pull in data from a few different sources, but the right approach depends on where that data is coming from. Importing an existing file, like a spreadsheet export or a CSV, is built into Google Sheets. Importing data from an API, however, usually means working with ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.json.org/json-en.html"},"children":["JSON"]}," (JavaScript Object Notation), a format Google Sheets has no native support for."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This article covers both: the quick, built-in way to import a file, and a custom solution for pulling JSON data from an API."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"import-a-spreadsheet-or-data-file","__idx":1},"children":["Import a spreadsheet or data file"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Google Sheets can import existing spreadsheets and data files directly, which is the fastest way to bring in a one-time export or a file you already have. Follow ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://support.google.com/docs/answer/40608"},"children":["Google's guide to importing data"]}," for instructions."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"import-json-data-from-an-api","__idx":2},"children":["Import JSON data from an API"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Google Sheets doesn't have a built-in way to import JSON, even though it's the format most APIs use to serve data on demand. Google Sheets does ship with a few functions for other structured formats — ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IMPORTXML"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IMPORTHTML"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IMPORTFEED"]}," among them, ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://support.google.com/docs/answer/12188454"},"children":["documented here"]}," — but none of them parse JSON."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The most common workaround is ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/bradjasper/ImportJSON/blob/master/ImportJSON.gs"},"children":["ImportJSON"]},", a community-built Apps Script that adds a custom ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["=ImportJSON()"]}," function to your sheet. It fetches a URL and converts the JSON response into the two-dimensional table format Google Sheets expects."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"install-the-script","__idx":3},"children":["Install the script"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Copy or download the script from its ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/bradjasper/ImportJSON/blob/master/ImportJSON.gs"},"children":["GitHub repository"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["With the Google Sheet open, go to ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Extensions > Apps Script"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Replace the contents of the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Code.gs"]}," file with the script you copied."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Save project"]}," (or use ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Ctrl+S"]}," / ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["⌘+S"]},")."]}]},{"$$mdtype":"Tag","name":"Image","attributes":{"src":"/assets/import-data-into-a-google-sheet_1.926b3cabcefae13b12120c2bcfcc5c6cbd192e28051423bc3e7e69163410b582.4783b0ec.gif","alt":"install-the-importjson-apps-script","framed":false,"withLightbox":true,"className":"ss-img"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"use-the-function","__idx":4},"children":["Use the function"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select an empty cell with no content to its right or below it."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enter ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["=ImportJSON(\"https://api.usaspending.gov/api/v2/references/toptier_agencies/\")"]},", replacing the URL with your target API endpoint."]}]},{"$$mdtype":"Tag","name":"Image","attributes":{"src":"/assets/import-data-into-a-google-sheet_2.9f36406fa7f818413016ba06f18ed433caaca8ed2c140eceb376e6b5e8efbb84.4783b0ec.gif","alt":"use-the-importjson-function-in-a-cell","framed":false,"withLightbox":true,"className":"ss-img"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ImportJSON"]}," also accepts optional parameters for filtering and shaping nested data — these are documented directly in the script's comments (shown in green)."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"considerations","__idx":5},"children":["Considerations"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ImportJSON"]}," works well for simple, public APIs, but it isn't a one-size-fits-all solution. Keep the following in mind before relying on it for reporting:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Authentication"]}," — Only works against APIs with ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://en.wikipedia.org/wiki/Basic_access_authentication"},"children":["Basic authentication"]}," or no authentication at all. Most other auth schemes (API keys, OAuth, etc.) aren't supported without modifying the script."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Bot detection"]}," — Some APIs block requests that look automated rather than coming from a browser. The script doesn't attempt to work around this."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Nested data"]}," — JSON isn't inherently two-dimensional, so deeply nested structures (objects containing arrays of objects, and so on) may not flatten into a usable table."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Data volume"]}," — Large responses can hit size limits and fail silently or with an error, depending on the API."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Sync frequency"]}," — ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ImportJSON"]}," only refreshes while the sheet is open in a browser. Once closed, the data goes stale until someone reopens it — this makes the approach best suited to data that rarely changes, or where occasional manual refreshes are acceptable."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Maintainability"]}," — The script is no longer actively maintained, so there's no guarantee it keeps working as Google updates the Apps Script platform."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"need-something-more-reliable","__idx":6},"children":["Need something more reliable?"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If these limitations get in the way of building the reports or dashboards you need, ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/set-up-a-custom-integration"},"children":["set up a Custom Integration"]}," instead. It pulls data directly from the API into Databox as a dataset, without using a Google Sheet as a go-between."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you'd rather have someone else find the best path forward, get in touch. Our team has experience connecting hundreds of different APIs and can help with custom solutions."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"Callout","attributes":{"type":"note"},"children":["To book a call with a product expert: paying customers can ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://meetings.hubspot.com/databox-meeting/account-management-custom-integration-request"},"children":["schedule here"]},", and free users or those without an account yet can ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://meetings.hubspot.com/databox-meeting/custom-integration-evaluation-call-website"},"children":["schedule here"]},"."]}]},{"$$mdtype":"Tag","name":"Faq","attributes":{},"children":[{"$$mdtype":"Tag","name":"FaqItem","attributes":{"question":"Can I use ImportJSON with an API that requires an API key?"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Not without modifying the script. As published, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ImportJSON"]}," only supports Basic authentication or unauthenticated (public) APIs."]}]},{"$$mdtype":"Tag","name":"FaqItem","attributes":{"question":"Why does ImportJSON return an error or blank cells?"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This usually means the API requires authentication the script doesn't support, blocked the request as automated traffic, or returned a nested structure that doesn't flatten cleanly into a table. See the considerations above."]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[" "]},{"$$mdtype":"Tag","name":"Cards","attributes":{"columns":4,"cardMinWidth":160},"children":[{"$$mdtype":"Tag","name":"FooterCard","attributes":{"title":"Ask Genie","icon":"genie","to":"https://app.databox.com/genie","variant":"elevated"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get instant answers or help with your data using the in-app AI assistant."]}]},{"$$mdtype":"Tag","name":"FooterCard","attributes":{"title":"Talk to an expert","icon":"assistance","to":"https://meetings.hubspot.com/databox-meeting/account-management","variant":"elevated"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For customers: Get help with your setup, strategy, or making the most of Databox."]}]},{"$$mdtype":"Tag","name":"FooterCard","attributes":{"title":"Book a demo","icon":"eye-open","to":"https://meetings.hubspot.com/databox-meeting/ref-knowledge-base","variant":"elevated"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["New to Databox? See how it works and get guidance on getting started."]}]},{"$$mdtype":"Tag","name":"FooterCard","attributes":{"title":"Send an email","icon":"help","to":"mailto:help@databox.com","variant":"elevated"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Reach out to support for help with your account, data, or technical issues."]}]}]}]},"headings":[{"value":"Import data into a Google Sheet","id":"import-data-into-a-google-sheet","depth":1},{"value":"Import a spreadsheet or data file","id":"import-a-spreadsheet-or-data-file","depth":2},{"value":"Import JSON data from an API","id":"import-json-data-from-an-api","depth":2},{"value":"Install the script","id":"install-the-script","depth":3},{"value":"Use the function","id":"use-the-function","depth":3},{"value":"Considerations","id":"considerations","depth":2},{"value":"Need something more reliable?","id":"need-something-more-reliable","depth":2}],"frontmatter":{"slug":"import-data-into-a-google-sheet","seo":{"title":"Import data into a Google Sheet","description":"Bring spreadsheets, data files, and JSON API data into a Google Sheet, and see what to do when native import options fall short."},"keywords":{"includes":["import json to google sheets","import data into google sheets","importjson","google sheets apps script","import spreadsheet google sheets","import csv google sheets"]}},"lastModified":"2026-08-05T14:05:50.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/import-data-into-a-google-sheet","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}