Google Sheets setup
Create a Google service account and point SheetForge at its JSON key. SheetForge can then read private sheets and write to them. Every step happens in a web browser and costs nothing. No prior Google Cloud experience is assumed.
Access modes
SheetForge reads Google Sheets in two modes.
| Mode | Credentials | What it does |
|---|---|---|
| ExportUrl | None | Read-only import of a sheet shared by link |
| SheetsApi | A Google service account | Everything else: private sheets, reflect and Push |
Reflect and Push both write to the sheet. Reflect writes the edits that the Data Studio holds to the source. Push sends baked values to the live sheet, cell by cell.
To import in the ExportUrl mode:
- Share the sheet by link.
- Register each tab's
#gid=value in the gid map. - Run the import.
This page walks through the SheetsApi setup end to end. You create the service account, download its JSON key, share your spreadsheet with it, and point SheetForge at the key.
Before you begin
You need a Google account. It does not need to be the one that owns the spreadsheet. A personal account always works.
Some company Google Workspace organizations disable service-account key downloads by policy. In such an organization, Download the JSON key fails with an organization-policy error. See Key creation is disabled.
Set up SheetsApi access
Create a Google Cloud project
- Open console.cloud.google.com and sign in with a Google account. On a first visit, accept the Terms of Service prompt to reach the console.
- In the top bar, click the project picker, then New project. The project picker is the dropdown next to the Google Cloud logo.
- Enter any name, for example
sheetforge-sheets, and click Create. Leave organization and location at their defaults. - When the "project created" notification appears, select the new project in the picker.
Every later step happens inside this project, so make sure it stays selected.
A project is a container for API settings. Creating one is free, and the Sheets API usage in this guide has no cost.
Enable the Google Sheets API
- Open the left-hand menu (☰) and go to APIs & Services ▸ Library.
- Search for Google Sheets API and open the result.
- Click Enable.
If the button reads Manage, the API is already enabled. There is nothing to do.
Create a service account
A service account is a machine identity with its own e-mail address. SheetForge signs in as this identity. Your personal Google password is never involved.
- Go to APIs & Services ▸ Credentials.
- Click + Create credentials ▸ Service account.
- Enter a name, for example
sheetforge-reader. The account ID fills in automatically. Click Create and continue. - The "Grant this service account access to project" and "Grant users access to this service account" steps are optional. Skip both and click Done.
Access to your spreadsheet is granted by sharing the sheet, not by project roles. You share the sheet in Share the spreadsheet.
If the console suggests configuring an OAuth consent screen, ignore it. Service accounts do not use one.
Download the JSON key
- Back on the Credentials page, click the service account you just created, under "Service accounts".
- Open the Keys tab.
- Click Add key ▸ Create new key, choose JSON, and click Create.
The browser downloads a file named like
sheetforge-sheets-1a2b3c.json.This is the only copyGoogle does not keep the key for re-download. If you lose it, delete the key in the Keys tab and create a new one.
Treat this file like a password:
- Move it somewhere outside your Unity project and repository, for example
C:/keys/sheetforge.json. - Never put it under
Assets/. Everything there is committed with the project. A stray reference, or aResourcesorStreamingAssetsfolder, can carry it into a build. - If the key ever leaks, delete it in the Keys tab and create a new one. Deleting revokes it immediately.
Share the spreadsheet
The key alone grants nothing. The service account can only read sheets that were explicitly shared with it, exactly like a human collaborator.
- Open the downloaded JSON file in any text editor and copy the
client_emailvalue. It looks likesheetforge-reader@sheetforge-sheets.iam.gserviceaccount.com. - Open your spreadsheet in Google Sheets and click Share.
- Paste the address and pick a role:
- Viewer is enough for import.
- Editor is required to write to the sheet, which means reflect and Push.
- Turn off "Notify people" and confirm. The address has no inbox.
- If Google warns about sharing outside your organization, confirm. A service account belongs to no organization.
Skipping this step is the most common setup mistake. Every request then fails with a permission error, no matter how correct the key is.
- Open the downloaded JSON file in any text editor and copy the
Set the source in the settings asset
- In your import settings asset, set Source Mode to Google Sheet and Access Mode to SheetsApi.
- Fill Spreadsheet ID (
spreadsheetId) with the long ID from the sheet's URL, the part between/d/and/edit.
Tell SheetForge where the key is
Choose one of two ways. The environment variable is the recommended one.
Set
SHEETFORGE_SHEETS_KEYto the absolute path of the JSON file. Each developer sets their own, and no path ever enters the repo.- On Windows, run
setx SHEETFORGE_SHEETS_KEY "C:\keys\sheetforge.json"in a terminal. Then restart Unity and Unity Hub, because already-running processes keep their old environment. - On macOS or Linux, export it in your shell profile and start Unity from that shell. On macOS you can also use
launchctl setenv.
Open ⚙ Settings in the Data Studio toolbar and put the path in its Service Account Key Path section. Type it, or use Browse…. Point it outside the repository.
The section keeps a default for the project. If you keep several settings assets, it also keeps a value for the open workbook, the one the Data Studio shows. That value wins when both are filled. Forget key clears a value.
Both values are per-user, so nothing about your key reaches the repository or your teammates.
The line under the fields names the path actually in use and where it came from. It warns you when the file is missing, or when what you pasted looks like a spreadsheet id.
The environment variable takes precedence over the values in the Settings dialog.
- On Windows, run
Run an import
Open Tools ▸ SheetForge ▸ Data Studio and press ↓ Import.
A successful report means the whole chain is working: project, API, account, sharing and key.
If something fails
Permission error
Symptom. A request fails with PERMISSION_DENIED (403).
Cause. The sheet is not shared with the client_email address. The ID points at a real spreadsheet that the service account cannot see.
Fix. Share the sheet with that address, as in Share the spreadsheet.
Spreadsheet not found
Symptom. A request fails with Requested entity was not found (404).
Cause. spreadsheetId is wrong.
Fix. Copy exactly the segment between /d/ and /edit in the sheet's URL.
Key creation is disabled
Symptom. Download the JSON key fails with "Service account key creation is disabled" or another organization policy error.
Cause. Your Google Workspace organization enforces iam.disableServiceAccountKeyCreation.
Fix. Ask an administrator to allow key creation for this project, or create the project under a personal Google account. The spreadsheet can be shared with that project's service account no matter who owns the sheet.
The API is not enabled
Symptom. A request fails with "Google Sheets API has not been used in project … or it is disabled".
Cause. The API is not enabled in the project that issued the key.
Fix. Enable the API in that project, not in some other project, as in Enable the Google Sheets API. A freshly enabled API can take a few minutes to propagate.
Key file not found
Symptom. A request fails because SheetForge does not find the key file.
Cause. The path has a typo, or Unity was started before the environment variable existed.
Fix. Set the variable, then restart Unity and Unity Hub.
Key compromised or lost
Replace the key with a new one:
- Delete the key in the service account's Keys tab.
- Create a new JSON key.
- Replace the file.
Nothing else changes. The e-mail address and the sheet sharing stay valid.
Next steps
- Import sources
The two Google modes side by side, and the gid map.
- Push to Google Sheets
The safety guards that Push applies.
- Getting started
The settings asset and your first import.
- Import and Google Sheets
Answers to Google-related questions.