Web Google Sheets access
How the web app reaches Google Sheets depends on the credential you bring. The deployed website offers two ways in, side by side. You sign in with Google (OAuth), or you pick a service-account key file that your own browser uses directly. The Unity and local path keeps its machine-local service-account key.
Which path does what
| Where you run | Google credential | Reads | Writes |
|---|---|---|---|
| Unity / local | Service-account key, read from a machine-local path | Yes | Yes. Surgical cell writes, structure rewrite, Push |
| Deployed site | The signed-in user's OAuth token (drive.file, the files opened for the app) | Yes | Yes. Same core plan and pre-send verification |
| Deployed site | A service-account key file you pick, used by your browser directly | Yes | Yes. Same core plan and pre-send verification. Requests go from your browser straight to Google |
The deployed site also has server-side service-account routes. They are gated closed (501).
The write behavior is identical wherever it runs, because every path shares the core plan and the pre-send verification. Only the transport changes: a browser-signed service-account token, a per-user OAuth bearer, or the local server's key.
Sign in with Google
On the deployed site, a signed-in user can both read and write Google Sheets over their own OAuth token.
Sign-in follows least privilege. It asks for your basic profile and per-file spreadsheet access (drive.file). The app can read and write only the spreadsheet files you have explicitly opened for it. Nothing is account-wide. The app cannot list or browse the rest of your Drive, and a file you have not opened for it stays invisible.
Choose a spreadsheet
You never need a spreadsheet ID. The signed-in tab leads with Choose a spreadsheet from Google. It opens Google's own file picker over the page.
Pick one spreadsheet or several. Their IDs land in the panel and the import runs by itself. Each spreadsheet becomes its own workbook in the session, as Workbooks in a session describes. Picking is also what grants the app access to those files under drive.file, so one gesture does both.
A Current spreadsheet line shows what the panel is pointed at.
Start from a spreadsheet ID
Typing an ID by hand works too. The field is under an Advanced: start from a spreadsheet id fold. A previously saved ID keeps working.
The fold states the catch. Google only opens files you have picked at least once, so an ID for a file you never picked is refused until you pick it. The Allow file access… line covers that case.
Open a file for the app
Under drive.file, permission grows file by file. The app may hit a spreadsheet it has no access to yet, such as an ID typed under Advanced or a saved ID after switching accounts. The moment it hits the permission error, the app opens Google's own file picker with that spreadsheet already looked up.
Pick the file once. The import or the send you started finishes by itself. From then on, that spreadsheet behaves exactly as it always did.
You do not grant access in advance. The picker appears exactly when it is needed, preset to the file in question. The action you asked for retries automatically after you pick.
The Google panel keeps an Allow file access… line that opens the same picker at any time. Use it, for example, after switching to a different Google account.
Writes over OAuth
A write on the web runs through exactly the same core plan and the same shared pre-send verification, an optimistic lock, as every other path. The live sheet is checked again right before send. A cell that a third party changed after your import is skipped, never overwritten.
Only the transport layer differs. On this path it carries the OAuth bearer token.
Who may write
The sheet's ACL is the final authority. SheetForge does not decide who may write. Google does.
A 403 from Google is remapped to a permission message rather than a partial write, so a refusal reads as a refusal.
Where the OAuth token lives
The OAuth token is held in the session cookie (a JWT) and used by server actions. Google's file picker is the one exception. The picker is a Google widget that runs in the page, so opening it hands the page a short-lived access token for your own session.
- The page holds the token while the picker is in use.
- The token is valid for at most one hour.
- The page fetches the token from a same-origin endpoint that requires your login.
- The token is not stored or logged.
That is the same kind of trust the key-file path places in the page. The app's strict Content Security Policy is what guards it.
Use a service-account key file
The Google panel's second tab takes a service-account JSON key file. Everything that key does happens in your browser.
Reads and writes run through the same core plan and the same pre-send verification as the other paths.
The key never reaches the server
The browser itself signs the token request and calls Google's APIs directly. The key, the signed request, the access token and your sheet data never touch SheetForge's servers.
The server-side service-account routes stay gated closed (501) on the deployed site. The key-file path adds a capability without opening one.
Remember the key
If you choose to have the key remembered, the file's text is discarded immediately. What is kept is a signing key, on that device, in the browser's storage. Scripts on the page can use the signing key but can never read it back out.
Anyone who can open that browser profile could still recover the signing key. Treat the device as you would treat the key file itself.
Forget key removes it at once, in every open tab. The app also asks Google to revoke the current access token.
The ID field on the key-file tab
The key-file tab keeps its ID field on purpose. A service account has no signed-in browsing session to pick with. An ID, with the sheet shared to the account, remains the way in there.
The Unity and local path
Unity and the local development server use a service-account key that is read from a machine-local path. The key is never uploaded or bundled. It is the same key that Google Sheets setup describes.
Keep the key outside Assets/ and outside the repo. The repository contains no credentials.
Send staged edits from the web app
Edits you make in the web app are held as staged edits until you send them. To write them to the Google spreadsheet, press ↑ Send in the toolbar. One send covers every sheet you changed.
↑ Send appears once the app has a Google credential, from sign-in or a key file. It is disabled, with the reason, when there is nothing to send or the send is blocked.
Writing staged edits to the source is what the Data Studio calls a reflect. It is not the editor's Push, which sends baked values to a live Google sheet.
What a send covers
A send is session-wide, not tab-wide. Every sheet that holds staged changes goes out, whichever sheet you happen to be looking at. When the session holds several spreadsheets, each one receives its own plan.
The count on ↑ Send is the count that gets sent.
Approval
There is one approval per spreadsheet. The confirmation dialog lists the staged changes of all that spreadsheet's sheets together, with the sheet each row came from. It also names the sheets that are about to be written.
With several spreadsheets, a failure in one is reported by source and does not undo the others. The credential used for each spreadsheet is remembered per spreadsheet.
Structure first, then values
A send writes structure first, then values. The editor uses the same order.
- Sheets that need a full rewrite are rewritten first, under one rewrite approval that covers all of them.
- The cell-level writes for the remaining sheets follow in a single batch.
Structure edits, sheet renames, record-key renames and enum members need a full rewrite.
If a rewrite fails, the cell writes are not sent at all. The workbook is never left half-applied.
Sheets that are left out
A sheet that cannot be sent is left out by name rather than silently dropped.
| Sheet | Result |
|---|---|
| Some of its cells were flattened to fit the TSV grid when it was pulled | Left out by name |
| Its rewrite plan cannot be built | Left out by name |
| It could not be checked against the live copy | Receives nothing, while the others still go |
Dropdowns refresh with every send
After a send from the web app, the sheet's data-validation dropdowns are rewritten automatically. Every tab is rewritten in one batch. A reference column's dropdown is written as a range over the target sheet's key column, so it grows as records are added.
A rule aimed at a sheet tab that does not exist is skipped and reported. This matches what the editor writes to a Google sheet, as Dropdowns written into the sheet describes.
Next steps
- Google Sheets setup
Create the service account and JSON key for the Unity path.
- Push to Google Sheets
The push safety chain that the web write path shares.
- Several workbooks
Several spreadsheets in one session.
- SheetForge Web
The browser app this access lives in.