Skip to content
SheetForge

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.

ModeCredentialsWhat it does
ExportUrlNoneRead-only import of a sheet shared by link
SheetsApiA Google service accountEverything 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:

  1. Share the sheet by link.
  2. Register each tab's #gid= value in the gid map.
  3. 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

  1. Create a Google Cloud project

    1. 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.
    2. In the top bar, click the project picker, then New project. The project picker is the dropdown next to the Google Cloud logo.
    3. Enter any name, for example sheetforge-sheets, and click Create. Leave organization and location at their defaults.
    4. 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.

  2. Enable the Google Sheets API

    1. Open the left-hand menu (☰) and go to APIs & Services ▸ Library.
    2. Search for Google Sheets API and open the result.
    3. Click Enable.

    If the button reads Manage, the API is already enabled. There is nothing to do.

  3. 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.

    1. Go to APIs & Services ▸ Credentials.
    2. Click + Create credentials ▸ Service account.
    3. Enter a name, for example sheetforge-reader. The account ID fills in automatically. Click Create and continue.
    4. 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.

  4. Download the JSON key

    1. Back on the Credentials page, click the service account you just created, under "Service accounts".
    2. Open the Keys tab.
    3. 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 copy

    Google 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 a Resources or StreamingAssets folder, 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.
  5. 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.

    1. Open the downloaded JSON file in any text editor and copy the client_email value. It looks like sheetforge-reader@sheetforge-sheets.iam.gserviceaccount.com.
    2. Open your spreadsheet in Google Sheets and click Share.
    3. 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.
    4. Turn off "Notify people" and confirm. The address has no inbox.
    5. 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.

  6. Set the source in the settings asset

    1. In your import settings asset, set Source Mode to Google Sheet and Access Mode to SheetsApi.
    2. Fill Spreadsheet ID (spreadsheetId) with the long ID from the sheet's URL, the part between /d/ and /edit.
  7. Tell SheetForge where the key is

    Choose one of two ways. The environment variable is the recommended one.

    Set SHEETFORGE_SHEETS_KEY to 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.

    The environment variable takes precedence over the values in the Settings dialog.

  8. 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:

  1. Delete the key in the service account's Keys tab.
  2. Create a new JSON key.
  3. Replace the file.

Nothing else changes. The e-mail address and the sheet sharing stay valid.

Next steps