Google Sheets API Setup (2024)

  • Create a Service Account
    • 1. Create a Google Developer Account
    • 2. Create a Google Developer Project
    • 3. Enable the Google Sheeets API
    • 4. Creating a Service Acccount
  • Linking the Google Sheets Document
    • 1. Create the Google Sheets Document
    • 2. Share the Google Sheets Document
    • 3. Record Relevant Information
      • The Spreadsheet ID
      • The Sheet Name
      • The Grid ID

Note: If you are only going to read from the Google Sheets document, and notedit or write data to the document, you can skip the process of making a ServiceAccount. The only requirement is that the Google Sheets document is shared suchthat anyone with the link can read the document.

In this tutorial, we will be creating a Service Account, a user account that’screated to interact with a specific piece of software or service. In our case,this specific piece of software is the Google Sheets API. You can then reusethis Service account for other apps made with App Inventor.

1. Create a Google Developer Account

The first step to use the Google Sheets API is to create a Google DeveloperAccount. A Google Developer Account is a Google Account that is activated to usedeveloper tools, so if you have not already done so, begin by navigating tohttps://www.google.com and create a google account. Once you have done so,navigate to https://developers.google.com and sign in to your desired GoogleAccount. This does not need to be the google account which will own the GoogleSheets that you intend to use.

2. Create a Google Developer Project

Our next step is to create a coding project. Once you have logged into yourGoogle Developer Account, navigate to https://console.developers.google.com/. Ifthis is your first time using your Google Developer Account, you will beprompted to agree to the Terms of Service. Check the box and continue.

Google Sheets API Setup (1)

Next, you will be on the Developer Dashboard. If you have not created a projectbefore, you can create your first project by selecting [CREATE PROJECT].

Google Sheets API Setup (2)

If you are using an existing Developer Account and already have a Project, youwill be on a Project’s Dashboard. To create a new Project, click on the dropdown menu at the top of the webpage.

Google Sheets API Setup (3)

At the top of the pop-up menu, select NEW PROJECT.

On the Creation page, give the project a name. For this tutorial, we will nameit “App Inventor.” We don’t need to provide an organization, so we will leave itas No organization.

Google Sheets API Setup (4)

Click ‘Create’ to finish creating the project.

3. Enable the Google Sheeets API

The next step is to enable the Google Sheets API for your project. Click on the“+ Enable APIs and Services” button next to APIs & Services.

Google Sheets API Setup (5)

Enter in the search bar “Google Sheets API” and select the resulting API thatappears. Then click the Enable button for the API Library.

Google Sheets API Setup (6)Google Sheets API Setup (7)Google Sheets API Setup (8)

4. Creating a Service Acccount

Now that we have enabled the Google Sheets API for this project, we want tocreate a service account. Simply put, this service account will look a lot likea google email account. After selecting the ‘Enable’ button for the GoogleSheets API, you will be sent to the Overview tab for the Google Sheets API inyour project. To the right of the screen, click ‘Create Credentials’ to getstarted with creating the Service Account.

Google Sheets API Setup (9)

On the next page, we are presented with a guide that will ask various questionsabout what kind of project we are making. In the first drop down menu under‘Which API are you using?’, select the Google Sheets API.

Google Sheets API Setup (10)

After you select that, a follow-up question will appear below. Under thequestion “Where will you be calling the API from?”, select Other UI. Finally,under what data will you be accessing, select Application Data.

Google Sheets API Setup (11)

After entering the above information, click on the blue button labeled “Whatcredentials do I need?” This will take you to the second part of creating thecredentials. This part will allow you to customize the service account andshould look like the figure below.

Google Sheets API Setup (12)

The name of the service account is not important. For this tutorial, I will nameit “example-service.” You then set the role to Selecting Project > Editor, whichshould provide this service account with enough permissions. Make sure to savethe entire text in the box labeled Service Account ID. You should notice thatthis will look a lot like an email address. You will want to copy this ServiceAccount ID someplace so that we can use it later.

Google Sheets API Setup (13)

Make sure that “JSON” is selected under Key Type like it is above beforepressing ‘Continue’. This will download a JSON file with the name“AppInventor-####.json.”

When using the Google Sheets API component, we will upload this json file inorder to work properly. Make sure to keep this JSON safe!

Now that we have created a Service Account, we want to provide the service account access to the Google Sheets files we will or read from.

1. Create the Google Sheets Document

The first step, if you haven’t already, is to create a Google Sheets document.The name of the Google Sheets document can be anything you’d like. If youalready have a Google Sheets file you would like to use, then simply go to yourGoogle Drive and navigate anywhere you would like to create the document. Thenclick New and select New Sheet.

After you have created the Google Sheets file that you would like to use, yousimply need to share the Google Sheets file with the service account email wesaved from earlier. This will provide the service account with the permissionsyou need. You can specify whether the service account can only read the data orwhether the service account can read and write the data by changing thepermissions between Viewer and Editor respectively.

3. Record Relevant Information

Finally, there are a handful of pieces of information about the google sheetsdocument which you would need to record in order to properly access the file.You can also use this portion of the instructions as a reference for where tofind the information later.

You can read more about these terms here.

The Spreadsheet ID

The spreadsheet ID can be found in the url of the Google Sheets Document. The url of the Google Sheets Document is typically in the form:

https://docs.google.com/spreadsheets/d/<Spreadsheet ID>/edit#gid=<Grid ID>

The spreadsheet ID corresponds to the ID of the Google Sheets File.

The Sheet Name

Within a spreadsheet are individual sheets, each of which have unique titles and ID numbers. In this component, the title of the page is called the sheetName.

A single spreadsheet document can have multiple pages. By default, when youcreate a new Google Sheets document, the spreadsheet has a single page with thename “Sheet1”. You can find this in the tabs at the bottom left corner of thescreen like so:

Google Sheets API Setup (14)

You can add a new page to the document by pressing the “+” symbol. Doing sowill create a new tab next to Sheet1 that will read Sheet2.

Google Sheets API Setup (15)

Each block in the Google Sheets Component will ask you to specify the title of the page (or the “Sheet Name”) you want to read from or edit. For example, if I want to edit values on Sheet2, then I would provide the text “Sheet2” in the sheetName slot.

Additionally, you can rename the sheet to whatever you’d like by right clickingon the tab and clicking rename. Note, doing so would require that you changethe sheet name in the project as well to match.

The Grid ID

Similarly to the sheet name, this is used to refer to which page you would liketo edit. However, unlike the sheet name, the grid ID cannot be customized bythe user. Certain blocks require that the grid ID is provided instead of asheet name. To find the grid ID, navigate to the page you want to reference byclicking on the tab. In the URL, you should see that the end should have “gid=”followed by a number.

https://docs.google.com/spreadsheets/d/<Spreadsheet ID>/edit#gid=<Grid ID>

Unable to resolve host "oauth2.googleapis.com"

If you get this error message, double check your device’s connection to theinternet. This is a sign that the Android networking subsystem can’t resolvethe hostname, so it’s not able to talk to DNS.

Attempt to invoke virtual method … on a null object reference.

If you get this error message, double check that you have linked yourcredentials in the designer properties. If your Designer property reads“None…” like it says in the image below, click on the box and select the .jsonfile you got from the Service Account setup steps.

Google Sheets API Setup (16)

Unable to parse range: ______

If you get this error message, there may be an error with the range that youprovided. This could mean that the sheetName you’ve provided does not actuallyexist, or that the reference you provided is not valid A1-notation. To learnmore about A1 notation, see this reference:https://developers.google.com/sheets/api/guides/concepts#a1_notation

Google Sheets API Setup (2024)

FAQs

How to get the answers on Google Sheets? ›

On your computer, open a spreadsheet in Google Sheets. If you want to ask questions about data that's on a different sheet, at the top right click Edit and make your changes. Under "Answers," enter your question in the box and press Enter. To find answers, click the question under the text box.

How to set up the Google Sheets API? ›

Google Sheets API Setup
  1. Create a Service Account. Create a Google Developer Account. Create a Google Developer Project. Enable the Google Sheeets API. Creating a Service Acccount.
  2. Linking the Google Sheets Document. Create the Google Sheets Document. Share the Google Sheets Document. Record Relevant Information.

What is the API limit for Google Sheets? ›

Sheets API has per-minute quotas, and they're refilled every minute. For example, there's a read request limit of 300 per minute per project. If your app sends 350 requests in one minute, the additional 50 requests exceed the quota and generates a 429: Too many requests HTTP status code response.

How to authenticate to Google Sheets API? ›

Authorize credentials for a desktop application
  1. In the Google Cloud console, go to Menu menu > APIs & Services > Credentials. ...
  2. Click Create Credentials > OAuth client ID.
  3. Click Application type > Desktop app.
  4. In the Name field, type a name for the credential. ...
  5. Click Create. ...
  6. Click OK.
Apr 3, 2024

How do I add answer options in Google Sheets? ›

How to create and add a dropdown list in Google Sheets
  1. Select the cell or cells where you'd like to add a dropdown list.
  2. In the top menu bar, click Data. Then select Data validation. Or you can right-click your desired cell and select Dropdown.
  3. Choose the criteria for your dropdown menu, and add your options.
Sep 7, 2023

How do I download Google sheet responses? ›

  1. Open a form in Google Forms.
  2. At the top of the form, click Responses.
  3. Click More Download responses (.csv).

Is Google Sheets API free? ›

Using the Google Sheets API is free, but there are usage limits for each user. There are quotas for queries as well as quotas for document creation. Once you exceed these quotas, you will have to pay an amount depending on which G Suite plan you have.

Are Google APIs free? ›

All use of Google Search Console API is free of charge. However, it is subject to usage limits. Was this helpful? Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License.

Can you pull API data into Google Sheets? ›

Connecting API to Google Sheets allows you to automate data flow from your app or source and forget about having to manually export/import the data you need. For this, you only need to write a few lines of code and enjoy the automation.

How do I increase my Google API limit? ›

Quotas and limits
  1. In the Google Cloud console, go to the IAM & admin > Quotas page. Go to Quotas.
  2. Select the API Keys API quota that you want to increase: Read requests per minute and/or Write requests per minute.
  3. Click add Edit Quotas.
  4. Fill out the form on the right side.
  5. Click Submit request.

How do I check my Google API limit? ›

Option 1: API-specific quota
  1. Go to Google Cloud and sign in as a Google Workspace super administrator.
  2. Under Project, select the project you're using for the migration.
  3. On the left, click APIs & Services. Dashboard.
  4. Scroll to the bottom and click the API you want to monitor. The Overview tab shows details of the API.

Does Google Docs API cost money? ›

Pricing. All use of the Google Docs API is available at no additional cost. Exceeding the quota request limits doesn't incur extra charges and your account is not billed.

How do I pull data from Google Sheets? ›

Choose an option:
  1. Right click on the cell or cells. Data extraction .
  2. Click Data > Data extraction .
Jan 25, 2023

Where is Google Sheets API key? ›

Setting up API keys
  1. Go to the API Console.
  2. From the projects list, select a project or create a new one.
  3. If the APIs & services page isn't already open, open the left side menu and select APIs & services.
  4. On the left, choose Credentials.
  5. Click Create credentials and then select API key.

How do I use Google Sheets as a database API? ›

Enable Google Sheets API
  1. Go to Google Cloud Console and click on “Select a project” from the top-right corner. ...
  2. Click “New Project”. ...
  3. Name your project and click “Create”. ...
  4. Type in “Google Sheets” in the search bar and click on the “Google Sheets API”. ...
  5. Click on “Enable”.
Jul 19, 2022

How do I get Google Sheets to read to me? ›

Go to Google Docs, Slides, or Drawingsand open a file. Listen for these words: "Screen reader support enabled." If you don't hear anything, go to the Tools menu, select Accessibility settings, then select Turn on screen reader support. You should hear "Screen reader support enabled."

How do you show hints in Google Sheets? ›

Just Press Ctrl + F1 to show full hints in google sheet.

Top Articles
Finanzbuchhaltung einfach erklärt | Definition und Aufgaben
TikTok CPM: Understanding Rates, Costs & How to Optimize
Kostner Wingback Bed
Bank Of America Financial Center Irvington Photos
Printable Whoville Houses Clipart
Www.craigslist Virginia
Paris 2024: Kellie Harrington has 'no more mountains' as double Olympic champion retires
Sarah F. Tebbens | people.wright.edu
St Als Elm Clinic
Elden Ring Dex/Int Build
Mercy MyPay (Online Pay Stubs) / mercy-mypay-online-pay-stubs.pdf / PDF4PRO
Audrey Boustani Age
Connexus Outage Map
อพาร์ทเมนต์ 2 ห้องนอนในเกาะโคเปนเฮเกน
Mlb Ballpark Pal
8 Ways to Make a Friend Feel Special on Valentine's Day
Void Touched Curio
Current Time In Maryland
Best Nail Salon Rome Ga
Pricelinerewardsvisa Com Activate
Simplify: r^4+r^3-7r^2-r+6=0 Tiger Algebra Solver
Aldi Süd Prospekt ᐅ Aktuelle Angebote online blättern
Swgoh Turn Meter Reduction Teams
Mission Impossible 7 Showtimes Near Marcus Parkwood Cinema
Edicts Of The Prime Designate
Satisfactory: How to Make Efficient Factories (Tips, Tricks, & Strategies)
Big Lots Weekly Advertisem*nt
Little Rock Skipthegames
Mini Handy 2024: Die besten Mini Smartphones | Purdroid.de
Jermiyah Pryear
Il Speedtest Rcn Net
Preggophili
Greyson Alexander Thorn
Imagetrend Elite Delaware
Craigslist Scottsdale Arizona Cars
Account Now Login In
La Qua Brothers Funeral Home
Landing Page Winn Dixie
Roadtoutopiasweepstakes.con
JD Power's top airlines in 2024, ranked - The Points Guy
Moses Lake Rv Show
T&J Agnes Theaters
Busch Gardens Wait Times
Jason Brewer Leaving Fox 25
Directions To Cvs Pharmacy
Umd Men's Basketball Duluth
Zipformsonline Plus Login
Jimmy John's Near Me Open
Meee Ruh
Join MileSplit to get access to the latest news, films, and events!
What Are Routing Numbers And How Do You Find Them? | MoneyTransfers.com
Latest Posts
Article information

Author: Geoffrey Lueilwitz

Last Updated:

Views: 5675

Rating: 5 / 5 (60 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Geoffrey Lueilwitz

Birthday: 1997-03-23

Address: 74183 Thomas Course, Port Micheal, OK 55446-1529

Phone: +13408645881558

Job: Global Representative

Hobby: Sailing, Vehicle restoration, Rowing, Ghost hunting, Scrapbooking, Rugby, Board sports

Introduction: My name is Geoffrey Lueilwitz, I am a zealous, encouraging, sparkling, enchanting, graceful, faithful, nice person who loves writing and wants to share my knowledge and understanding with you.