Google Sheets
Pull translations into Unity and push local text to Google Sheets
Overview
Evo Localization supports importing Google Sheets into project assets in Edit Mode, pulling text updates into memory at runtime, and pushing local keys and translations back to Google Sheets from the editor.
Google Sheets sync handles text and optional key descriptions. Audio clips and sprites remain local Unity asset references.
Setup Guide
Prepare the Spreadsheet
- Create a sheet tab for each localization table you want to sync.
- Set the first column header to
Key. Add columns whose headers exactly match your Language IDs, including capitalization, such asen-US,de, andja. Display names such asEnglishonly work if they are also the language's ID. - Optionally add a
Descriptioncolumn for editor key descriptions. - For pulls, set sharing to Anyone with the link: Viewer. The integration downloads CSV through the spreadsheet's export endpoint without signing in.
| Key | Description | en-US | de | ja |
|---|---|---|---|---|
| menu_play | Main menu play button | Play | Spielen | プレイ |
| menu_settings | Main menu settings button | Settings | Einstellungen | 設定 |
Use unique, non-empty keys. At least one language column must match a language registered in Localization Settings. Unrelated columns are ignored on pull; duplicate matching language columns or duplicate Description columns are rejected. Description is reserved and cannot be used as a language ID.
Configure Unity
- Open Localization Settings, expand Integrations, and enable Google Sheets.
- Enter the Spreadsheet ID or the full HTTPS edit URL in the Spreadsheet ID field:
https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit. - Set each table's Sheet GID to the numeric tab ID from its URL, such as
0or123456. Each configured table needs a unique GID and a unique, non-empty table ID. Leave the GID empty to exclude a table from sync. - Select the runtime Update Mode described below.
Use the spreadsheet's edit URL or ID, not a Publish to web URL containing /d/e/. Pulls require publicly readable data. An OAuth token for editor pushes does not authenticate pulls.
Pull into Project Assets
Outside Play Mode, click Pull in Localization Settings. The pull window provides:
| Option | Behavior |
|---|---|
| Pull Descriptions | Imports the optional Description column. Enabled by default. |
| Remove Missing Pulled Keys | Removes local keys and their language entries when they are absent from the pulled sheet. Disabled by default. |
With removal disabled, pulls merge new and existing keys while retaining local keys missing from the sheet. Existing translations for languages without a matching sheet column are retained. An empty cell in a matching language column deliberately replaces its text with an empty string. Audio and sprite references on retained entries are preserved.
All configured tables must download and validate successfully before project assets change. Changes support Unity Undo. Cancel Sync cancels an editor sync in progress.
Enable Remove Missing Pulled Keys only when the sheet should define the complete key list. Removing an entry also removes the audio and sprite references stored on that entry.
Runtime Updates
| Update Mode | Behavior |
|---|---|
| Manual | Pull only when you call Pull() or use the Play Mode Pull button. |
| Once | Pull once after the runtime handler initializes. This is the default. |
| Continuous | Pull after initialization, then repeat after each pull completes. |
For Continuous mode, Update Interval (sec) defaults to 300 seconds and has a minimum of 30 seconds. The delay uses unscaled time.
Runtime pulls keep data in memory and do not modify language or table assets. Bundled content is available while downloading. Each successful table is applied independently; failures or cancellation retain previously valid data. Missing keys and language columns retain their existing values, while empty cells overwrite text. With fallback enabled, an empty translation can still display the default language's value.
Localized Objects refresh automatically when pulled data changes, except those using OnDemand. Custom integrations listening to LocalizationManager.OnLanguageSet also receive a refresh notification even when the selected language has not changed.
Scripting API
The handler is an instance property: LocalizationManager.Instance.GoogleSheets. It exists when Google Sheets was enabled during manager initialization.
using UnityEngine;
using Evo.Localization;
public class PullTranslations : MonoBehaviour
{
public void PullNow()
{
// Initialize the manager if it has not been used yet.
if (!LocalizationManager.IsLocalizationAvailable())
return;
var sheets = LocalizationManager.Instance.GoogleSheets;
if (sheets != null)
sheets.Pull();
}
}| Method | Behavior |
|---|---|
Pull() | Starts a fresh pull in Play Mode. Does nothing if a pull is already running. |
CancelPull() | Cancels the active pull while keeping valid downloaded data. |
ForceRefresh() | Cancels the current pull and starts a new one. |
ClearCache() | Cancels the pull, clears runtime data, and immediately restores bundled content. |
GetCachedString(tableId, key, languageId = null) | Reads the runtime table, using the current language if no ID is supplied. Returns null when no runtime entry is available. |
For normal lookups, use LocalizedObject.GetString("UI", "menu_play") or the manager's content methods so bundled and downloaded data are resolved together.
| Status / Callback | Meaning |
|---|---|
IsPulling, HasData | Whether a pull is running and whether runtime table data exists. |
PullProgress | Completed attempts divided by total tables, including failed attempts. |
SuccessfulPulls | Number of successfully pulled tables in the current or most recent pull. |
LastError, LastPullTime | Most recent error and the local completion time of a pull with at least one successful table. |
OnPullComplete | All configured tables have been attempted. Check LastError and SuccessfulPulls; completion does not guarantee success. |
OnPullError(string error) | Reports a configuration, download, or parsing error. |
OnTablePulled(int completed, int total) | Progress notification after a successful table. |
OnDataChanged | Runtime values changed, including after ClearCache(). |
Caching
The runtime cache lasts for the current session and is not saved to disk. Each new pull makes fresh requests; unchanged CSV does not trigger a redundant content refresh. In Continuous mode, pulling resumes after the update interval when the cache is cleared.
Push to Google Sheets
Push is available outside Play Mode and writes local project data to the configured sheet tabs.
- Click Push in Localization Settings.
- Use the window's OAuth Playground link to obtain a short-lived access token with the
https://www.googleapis.com/auth/spreadsheetsscope. The account must have edit access, and the Sheets API must be enabled for the token's project. - Paste the token into Access Token. It stays in editor memory and is not saved in assets or builds.
- Choose Include Descriptions to write the description column. The push window enables this by default.
- Click Review and Push, check the listed spreadsheet and tables, then confirm Push.
Push replaces the first columns with Key, optional Description, and language IDs in settings order. It clears trailing values in those columns and old Description or configured language columns outside that range. Other trailing columns and cell formatting are preserved. This changes the online spreadsheet; canceling after a write request has been sent cannot guarantee that Google has not already applied it.
Troubleshooting
- Pull is disabled: Check the integration toggle, spreadsheet value, registered languages, and at least one valid table GID. Duplicate table IDs or GIDs also prevent sync.
- CSV/header error: Check sharing permissions and that the first row begins with
Keyand contains a registered language ID. A sign-in page is not valid CSV. - Pull failed: Check the handler's Last Error in Play Mode or the editor sync status. Requests time out after 30 seconds, reject responses above 8 MiB, and retry transient network/server failures up to twice.
- Push failed: Check the token, its write scope, account edit access, and Sheets API configuration. Obtain a new token if it expired.
- Values appear unchanged: Check for empty cells triggering language fallback, missing language columns retaining existing data, or an OnDemand object needing
UpdateContent().