How to Use Google Sheets API to load data in JSON format?

Informula
IMU Framework Design
2 min readSep 1, 2023

Google Sheets is a spreadsheet application included as part of the free, web-based Google Docs Editors suite offered by Google. Besides the normal Excel-like usage, the developer can leverage API service and access to the data stored in the target range of the Sheets.

Step 1: Go to Google APIs and create a project (or select created project).

Step 2: Search on “Google Sheets API” in the marketplace and enable it.

Step 3: In the dashboard, select “Credentials” tab and click on “API Key”.

Step 4: Go to the new item created in the list of API Keys.

  • You can set up the restrictions for this key. For example, IP addresses or iOS apps. I selected Google Sheets API that his key can call for.
  • On the right-hand side, you can copy the key and paste into the link to retrieve the data.

Step 5: Here is how you can retrieve your data.

https://sheets.googleapis.com/v4/spreadsheets/SHEET ID/values/SHEETNAME AND RANGE?key=[API KEY]

You can refer to this post and when you copy its link (https://sheets.googleapis.com/v4/spreadsheets/1tdvRfB7vHSBWfT27cvHGLi5riurc_BR2XCulJmAXGW4/values/Sheet1!A2:E100?key=AIzaSyB5WTjIR5OZt108xl9uQApzeoNRWuMyYRE), you will get the returned data like this.

Thank you and more to come!

If you want to support Informula, you can buy us a coffee here :)

𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲

--

--