Skip to content
SheetForge

Several workbooks

A workbook is one settings asset, with the source, the output folder and the namespace that asset names. A project can hold several workbooks. You choose which ones you are working on, and a tab in one workbook can reference a tab in another. A tab is one table of your data. The Data Studio also calls it a sheet.

A team rarely keeps a whole game in one spreadsheet. Items live in one Google spreadsheet, monsters in another, and the localization text in a third. Different people own each one, and all of them are imported into the same Unity project. Each spreadsheet gets its own settings asset, so each one is a workbook.

This page covers how you choose workbooks, how they are imported, and how the Data Studio shows several at once.

In this chapter

  • References across workbooks: reference a tab in another workbook, and see what reflect, Export, Push and import do with those references.
  • Workbook map and limits: read the workbook map, follow records into other workbooks on the canvas, and check the limits.

One settings asset is one workbook

A SheetForgeSettings asset names a source, an output folder and a generated namespace. Those three together are a workbook. A project may hold as many as it needs.

Workbooks coexist all the way through. Each of these is kept per workbook:

  • Baselines
  • Baked assets
  • Generated code
  • Delivery registrations
  • The pre-build freshness check

Core concepts describes what a workbook owns.

Names that are unique across the project

Two names are unique across the whole project rather than within a workbook: tab names and sheet-defined enum names.

A tab name is the address (SheetForge/{tab}) and the generated type ({tab}Database), so two workbooks cannot both own one. An import that would collide is refused. The refusal names the settings asset that already owns the name.

That rule is what makes references across workbooks possible. RecordId@Items can only ever mean one tab, whichever workbook it sits in. A reference never needs to say which workbook it means.

The active set

The workbooks you are working on form the active set. Import runs over every workbook in the set. The open workbook is the one the Data Studio shows.

You change the set in any of three places. All three show the same set.

  • The Getting Started window
  • The workbook list in the Data Studio: a menu in the toolbar by default, or sections in the sidebar
  • The inspector of a settings asset

At least one workbook stays active, so the last ticked workbook cannot be unticked. With a single settings asset in the project, the first import selects it and there is nothing to choose.

The set and the open workbook are stored per project and per user, as an EditorPrefs setting. They never touch version control, and every teammate keeps their own. If an active settings asset is deleted, the set drops it without being asked.

In the Getting Started window

Open Tools ▸ SheetForge ▸ Getting Started. The import settings list shows every settings asset with a check box. Tick as many as you like.

The workbook the Data Studio currently shows carries the open badge. Each row also says how the workbook relates to the others.

Hint on the rowMeaning
→ Items, MonstersThe workbooks this one references
not active — checked against its last importA referenced workbook you have not ticked
not imported yetA workbook with no import behind it

In the Data Studio toolbar

Open Tools ▸ SheetForge ▸ Data Studio. The toolbar has a workbook menu whenever the project holds more than one workbook. With a single settings asset the menu is hidden. The label of the menu names the open workbook and counts the active ones.

Each row of the menu has these things:

  • A check box, the same check as in Getting Started. An inactive workbook shows an empty box.
  • The workbook's name, which puts that workbook in the table when you click it. Its tags, pending count and source kind follow it.
  • The same relation hint, under the row

Read the workbook menu describes each part of a row.

Workbook map… sits at the bottom of the menu, unless the workbook map is shown elsewhere. Where the map lives describes the places.

Move the list into the sidebar

By default, the workbook menu is where the list lives. To move the list into the sidebar, open ⚙ Settings in the Data Studio toolbar and set Workbook list to Sidebar sections. The default is Toolbar menu.

In the sidebar, the list is a standing section per workbook with the same check, name and pending count. Every workbook's state stays in view without opening anything.

In the settings asset inspector

Select a settings asset in the Project window. Its inspector has an Active — imported by Import toggle and an Open in Data Studio button. The toggle is disabled on the last active workbook.

Add a workbook from the Studio

The Data Studio sidebar has an Add workbook section. Press Google spreadsheet… or Local folder or .xlsx…, and one form opens: a name, the source, and its spreadsheet address, folder or file.

Create writes the settings asset at Assets/{name}/{name}.asset and adds the workbook to the active set. When the source already holds sheets, its first import starts on its own. Getting Started's New settings asset opens the same form. See Workbooks in the Studio.

How workbooks are named

Every row in these lists names a workbook by its settings asset's file name.

That changes when two settings assets in the project share a file name. Two teams may both have called their settings SheetForgeSettings, for example. The name shown everywhere then becomes the folder directly above the asset instead, such as SheetForge.PluginDemo. You can tell the rows apart without reading a full path.

If you would rather see the full pair, open ⚙ Settings and set Short workbook names to Folder/file name. Every workbook is then spelled out as folder/file whenever names repeat. The default is Folder name when file names repeat.

Whichever rule is chosen, the same name is used in all of these places:

  • The toolbar
  • The sidebar
  • The canvas chips
  • The workbook map
  • Getting Started
  • Every message that names a workbook

Import the active set

Import follows the active set. In the Data Studio toolbar, ↓ Import imports every active workbook, in dependency order. The workbooks that are referenced go first, so the ones that reference them validate against fresh data. Run Import in the Getting Started window does the same.

Active workbooksThe button
Two or moreGives the count in its tooltip
OneImports that one workbook, as in a project with a single workbook

Import every workbook

When the project holds more than one workbook, Pull every workbook runs every workbook in the project, active or not, in the same order. It stands beside ↓ Import in the toolbar when a Google Sheets workbook is in play. Otherwise it waits in ⋯ and in the menu of the last-import status on the status bar. The Getting Started window has the same button. Running it does not change the active set.

What a batch does

An import of several workbooks runs as one batch. The batch carries on across the domain reloads that code generation causes. It restores the open workbook when it is done, and it reports one summary.

Import from a script

CallWhat it imports
SheetForgeActions.RunImportActive()The active set
SheetForgeActions.RunImportAll()Everything

Choose a Data Studio view

The Data Studio's ⚙ Settings has a Data Studio view choice. Changing it redraws an open Studio at once, with staged edits intact.

By default, that dialog is the only place to change the view. To switch without leaving the table, set View mode switch to Also in the sidebar in the same dialog. A small One workbook at a time · All active workbooks together toggle then appears at the top of the sidebar.

One workbook at a time

This view is the default. The table shows the open workbook.

Under the sheets, a collapsed Other workbooks section lists the tabs this workbook references that belong to workbooks not open here. Those tabs are read-only and grouped by workbook. The section also shows the number of edits waiting to be written into each of those workbooks. Click an entry to open that workbook.

To get one section per workbook instead of that one box, open ⚙ Settings and set Tabs of other workbooks to Collapsed sections per workbook. Each section has its own header, which names the workbook and says how many edits wait there. The default is One collapsed box.

All active workbooks together

The sidebar is grouped by workbook, one group per active workbook. Every tab in those groups is editable.

A tab may belong to a workbook outside the active set and be referenced from inside it. That tab still appears. It is read-only and sits in the same Other workbooks section.

In this view, the Create sheet dialog gains a Workbook choice. The choice is preset to the workbook of the sheet you had selected.

Sheet names already taken

In either view, a name already taken anywhere in the project disables the button in the Create sheet dialog. The dialog says which workbook has the name.

Switch with staged edits

Switching does not ask you to confirm anything. Each of these keeps every staged edit where it is:

  • Opening another workbook
  • Unticking a workbook
  • Changing the view

If the workbook you are leaving has edits that are not yet reflected, the Studio shows one notice. The notice says how many edits, in which workbook, and that they will be written when you reflect. The Console gets the same line.

The toolbar button ↑ Send runs the reflect. Its pending count counts every workbook's edits, and its tooltip breaks the count down by workbook.

Ctrl+Z walks back through all of the edits, whichever workbook each edit belongs to.

Read-only tabs

A tab from another workbook is read-only for what you do on it. It is not read-only for what your own edits imply.

What is refused

These actions on a tab from another workbook are refused:

  • Editing a cell
  • Changing the structure
  • Moving rows

The refusal gives the reason: "This tab belongs to workbook X and is read-only here", where X is the workbook's name. The menu items that would do these things are disabled.

Opening such a tab shows the same sentence as a standing banner above the table. The banner has a button, Open in followed by the workbook's name, that jumps straight to the tab's own workbook. The reason is visible the moment you land there, not only once you try to change something.

What is allowed

Staging that your own edits cause in that tab is allowed:

  • A key rename that rewrites referencing cells there
  • A tab or enum rename that rewrites the @type cells using the old name
  • A localization key minted from a LocRef cell
  • A record or enum member created from a picker
  • A record created while wiring on the canvas

Those edits land in the other workbook's pending count. They are written to its source when you reflect.

Next steps