1.8 KiB
1.8 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, set the credentialsPath field to the JSON file path, and remove any apiKey or apiKeys entries if you are using service account auth.
Example:
{
"credentialsPath": "credentials.json",
"rateLimitPerMinute": 50,
"documents": [
{
"documentId": "YOUR_SPREADSHEET_ID",
"outputDir": "output/your-document",
"sheets": [
{
"name": "Sheet1",
"outputFilename": "sheet1.csv"
}
]
}
]
}