2.0 KiB
2.0 KiB
Google Service Account Setup for Google Sheets Rate Assistant
This guide explains how to create a Google service account, enable the Sheets API, and configure the project to use service account credentials.
1. Enable the Google Sheets API
- Open the Google Cloud Console: https://console.cloud.google.com/
- Select an existing project or create a new one.
- In the left menu, open APIs & Services > Library.
- Search for Google Sheets API and click it.
- Click Enable.
2. Create a service account
- In the Cloud Console, open IAM & Admin > Service Accounts.
- Click Create Service Account.
- Enter a name and description.
- Click Create and continue.
- Skip granting optional roles or add a minimal role if required.
- Click Done.
3. Create and download credentials
- Find the service account you created in the list.
- Click the service account name.
- Open the Keys tab.
- Click Add Key > Create new key.
- Choose JSON and click Create.
- Save the downloaded JSON file securely in your project folder, for example
credentials.json.
4. Share your Google Sheets with the service account
- Open the Google Sheet you want to export.
- Click Share.
- Add the service account email address, which looks like
...@...iam.gserviceaccount.com. - Give it Viewer access.
5. Configure the project
In config.json, add the service account credentials under the serviceAccounts array. Here's an example using service account authentication:
{
"serviceAccounts": [
{
"path": "credentials.json",
"rateLimitPerMinute": 50
},
{
"path": "credentials_2.json",
"rateLimitPerMinute": 50
}
],
"documents": [
{
"documentId": "YOUR_SPREADSHEET_ID",
"outputDir": "output/your-document",
"sheets": [
{
"name": "Sheet1",
"outputFilename": "sheet1.csv"
}
]
}
]
}
The app will round-robin requests across configured accounts and respect rateLimitPerMinute values.