Google Sheets API Key vs Service Account: Which Do You Need?

Google Sheets API key or service account: an API key reads public sheets only, a service account reads shared sheets. Quota: 300 reads a minute per project.

By Archit Tamrakar · LinkedIn · · 5 min read

Use an API key to read a public Google Sheet, a service account for a script that reads or writes sheets shared with it, and OAuth 2.0 when your app acts for a signed-in person. Google's usage limits page sets the read quota at 300 requests per minute per project and 60 per minute per user, and says standard use of the Sheets API costs nothing (as of 3 September 2026).

Which Google Sheets credential should you use?

Google says Workspace APIs take one of three credentials: an API key, an OAuth client ID, or a service account, depending on the access you need (Create access credentials, 12 October 2026). The table compares them for a script that reads or writes a sheet.

API keyOAuth 2.0 client IDService account
Use it whenThe sheet is public and the script only reads itThe app reads or writes a person's own dataA script or server works with sheets shared with it
Whose accessAnonymousThe user who consentsThe service account, a robot account
Which sheets it reachesFiles shared with "Anyone on the Internet with this link"Whatever the user grantsSheets shared with the service account's email
User consentNot requiredRequiredNot required
What you download or copyA long key stringClient ID, then tokens after consentA JSON key file

When is an API key enough?

An API key is enough when the sheet is public and your script only reads it. Google says API keys anonymously access publicly available data, such as Workspace files shared with the "Anyone on the Internet with this link" setting (Create credentials, 12 October 2026). A key cannot open a private sheet, and no user approves anything.

  1. Open the Google Cloud console and go to Menu > APIs & Services > Credentials.
  2. Click Create credentials > API key.
  3. Copy the key. It is a long string of upper and lower case letters, numbers, underscores and hyphens. Keep it out of public code.
  4. Open the sheet and set sharing to "Anyone on the Internet with this link".

Google's guide also names the sharing setting that must be on for the key to work, so check it before you debug your script. The key only reads. If your script needs to change a cell, an API key is the wrong credential.

For the reverse direction, pulling data from an API into a sheet, see How to Pull API Data Into Google Sheets.

When do you need a service account?

A service account is "a special kind of account used by an application, rather than a person," so it suits scripts that run on a schedule or on a server. Google says you can give it access to one sheet by sharing that sheet with the service account's email address (Create access credentials, 12 October 2026). DEV Community describes the setup as server-to-server, with no user involved (DEV Community, 11 May 2026).

  1. In the Google Cloud console, go to Menu > IAM & Admin > Service Accounts and create a service account in your Google Cloud project.
  2. Download its JSON key file. According to DEV Community, the file holds the key pair Google uses to verify your app, so treat it like a password.
  3. Open the sheet, click Share, and paste the service account's email address. Give it editor access if the script writes to the sheet.

Access is wide if you share carelessly. Google's guide says that when an app authenticates as a service account, it has access to all resources that the account has permission to access. Share only the sheets the script needs.

Domain-wide delegation is a larger grant. It lets a service account access user data across a Google Workspace domain, such as reading any user's Gmail or Calendar events, and the account must be authorized for it separately (Create access credentials, 12 October 2026). Most Sheets scripts do not need it.

When do you need OAuth 2.0 instead?

Use OAuth 2.0 when your app reads or writes a person's own data after that person agrees. Google says an OAuth client ID lets an app access user data, such as a person's email address, and that the app must request and receive consent from the user (Create credentials, 12 October 2026).

Every app that uses OAuth 2.0 needs a consent screen configuration. You only list scopes for apps used by people outside your Google Workspace organization (Authorizing requests, 3 September 2026).

OAuth takes the most setup of the three. It is also the only one of the three that asks the person whose data it is.

What are the Google Sheets API quotas?

Quotas are set per project and per user. Google's usage limits page sets read requests at 300 per minute per project and 60 per minute per user per project, with the same split for write requests (Usage limits, 3 September 2026). These limits apply to all three credential types.

LimitValueNotes
Read requests per minute per project300Shared by everything in the project
Read requests per minute per user per project60Applies per user
Write requests per minute per project300Same split as reads
Write requests per minute per user per project60Same split as reads
Recommended maximum payload2 MBGoogle recommends this "to speed up requests"
Processing time before a timeout180 secondsLonger requests return a timeout error
Batch request1 requestEach batch counts once, including its subrequests

The limits page says API calls by a service account are considered to be using a single account. A script that runs under one service account should therefore be counted against one per-user bucket of 60 reads and 60 writes per minute. For a script that makes many calls, that is the number to plan around, not the 300 per project.

Does the Google Sheets API cost money?

No. Google's usage limits page says all standard use of the Sheets API is available at no additional cost, as of 3 September 2026 (Usage limits, 3 September 2026).

Free: standard use of the Sheets API, with the quotas above. Paid: nothing listed for standard use as of 3 September 2026. Google says exceeding the quota limits is planned to incur charges to your Google Cloud billing account later in 2026.

Quotas still limit how fast a script can work, so a free API can still block a script that sends too many requests in a minute.

For a broader look at moving data in and out of a sheet, see How to Turn a Google Sheet Into an API.

Frequently asked questions

Can an API key write to a Google Sheet?

Not in this setup. Google describes an API key as anonymous access to publicly available data, such as files shared with the 'Anyone on the Internet with this link' setting, and it is read-only here. To write, use a service account that has been shared on the sheet, or OAuth 2.0 with the consent of the person whose sheet it is.

Do I need a service account for a Google Sheets script?

Not always. Use one when the script runs without a person, such as on a schedule or on a server, and needs to reach a sheet that is shared with it. Google describes a service account as an account used by an application rather than a person. If the script must act on a signed-in user's own sheets, use OAuth 2.0 instead.

What is the Google Sheets API read limit?

Google's usage limits page sets 300 read requests per minute per project and 60 read requests per minute per user per project, as of 3 September 2026. Write requests have the same split. A batch request counts as one request toward the limit, and a request that takes more than 180 seconds returns a timeout error.

Does the Google Sheets API cost money?

According to Google's usage limits page, all standard use of the Google Sheets API is available at no additional cost, as of 3 September 2026. Quotas still apply to every credential type, so a script that sends too many requests in one minute can be limited even though the API itself is free.

What is a service account JSON key file?

According to DEV Community, a service account JSON key file contains a key pair that Google uses to verify your app. Anyone holding the file can act as that service account, so store it like a password and never commit it to a public repository.

Sources

  1. Create credentials, Google Workspace (2026-10-12)
  2. Authorizing requests, Google for Developers (2026-09-03)
  3. Usage limits, Google for Developers (2026-09-03)
  4. Google OAuth 2.0 vs Service Account: Which One Should You Use?, DEV Community (2026-05-11)