GHUD uses a standardized Google Sheets structure to generate strongly typed C# data automatically.
Following these standards keeps the generated code predictable and prevents both data-loading and code-generation errors.
Most formatting errors will be detected by GHUD, but following these rules while building your sheets will prevent import errors and keep your database easy to maintain.
Standard Data Tab
A normal GHUD data tab begins like this:
The first three rows have special meanings:
Row 1: Names
Defines the tab's singular name in Column A and the generated accessor names in the remaining columns.
Row 2: Types
Defines the enum type for Column A and the data type of every other populated column.
Row 3: Defaults
Reserved for None and the default values used by the tab.
Row 4 and Below: Data
Data begins on Row 4.
The first column also has a special meaning, as it is the enum name generated to reference the row.
Create your custom data tabs to the right of the Scratch tab.
To start, it's easiest to repurpose one of the tabs in the GHUD Template Sheets rather than making a new one.
Right-Click on an existing tab, then click on Rename to change the name of the tab.
Your custom data tab names must use ProperCase and end with a lowercase 's'.
The name entered for the data tab will become the class name when the data is brought into Unity.
Because of this, tab names also must not violate C# class naming rules.
Once you need more sheets, duplicating one of the existing data tabs will preserve the formatting.
You can make a tab copy by Right-Clicking the tab, and selecting Duplicate.
Make sure to rename the tab afterwards.
You can also make a new tab using the + button on the bottom-left, Right-Clicking the new tab, then selecting Rename.
The alternating colors and other formatting is not required to make GHUD function,
but it is helpful as tabs become larger and more complex.
Updating Tab Names
After adding, deleting, renaming, or reordering data tabs, you must run:
Utilities > Update Tab Names
First Time Permissions
The first time will get an error. You will need to grant the Google Sheets permission to run macros in order to proceed.
Dismiss the black popup.
If, after dismissing, you get this popup:
Press OK and try to run Utilities > Update Tab Names again.
Dismiss the black popup bar again if it reappears.
You should now see a popup titled "Authorization required"
Click OK on it.
Another popup will open after that.
Click Advanced.
After that, Click Go to Database (unsafe)
The email in the popup will be your email.
Yet another popup will open after that.
Click Continue near the bottom-right.
Privacy Note:
Grand Hawk Union does not store, sell, or even view any of your Google Sheets Data.
However, Google is allegedly known to train their LLMs on your private Google Sheets data.
Grand Hawk Union is not responsible for any breach of privacy due to Google's LLM training.
After that, the update macro should run, and future runs of Update Tab Names won't require authorization.
It takes about a minute to run the update. Do not edit Google Sheets while the update is running.
You can verify the update went through by checking the Tab Names listed in Column N of the EnumsLoader tab.
After that, the update macro should run, and future runs of Update Tab Names won't require authorization.
It takes about a minute to run the update. Do not edit Google Sheets while the update is running.
You can verify the update went through by checking the tab names listed in Column N of the EnumsLoader tab.
Each tab should have a matching entry in Column N, and they should be in the same order.
The 0th tab, "None" should always be found in Row 3.
An extra tab used for system calibration is also appended at the end, so expect the last column to be listed as "ZZZs".
Another way to update the tabs is to click the Update Tab Names macro button on the EnumsLoader tab.
This functions the same as Utilities > Update Tab Names.
If you run Get All Data in GHUD without first running Utilities > Update Tab Names, you will get a console error like this:
GHUD Update All stopped before generating code because EnumsLoader ETab names do not match the Google Sheets tabs.
EnumsLoader ETab tabs: 'Abilities', 'Characters', 'Enemies', 'Items'
Google Sheets data tabs seen by GHUD: 'Abilities', 'Characters', 'Enemies', 'Items', 'NewThings'
The sheet has data tab(s) missing from EnumsLoader ETab: 'NewThings'
Run Utilities > Update Tab Names in the Google Sheets, then run Get All Data again.
Tab Order
To the left of your custom data tabs is the Scratch Tab.
GHUD uses the Scratch tab to locate the positions of your data tabs.
Feel free to edit the Scratch tab contents, but be aware of it's restrictions:
Do not add or remove tabs before the Scratch tab.
Do not move any tab to the left of Scratch.
Do not rename the Scratch tab.
Do not rename the EnumsLoader tab.
Do not edit hidden GHUD helper tabs unless you are deliberately expanding database capacity.
Column A
Column A defines the generated enum entries for the tab.
Cell A1 will set the class accessor enum for the tab, and so should always be named the singular form of the class name.
Cell A2 defines the type for the accessor in A1.
Following the GHUD enums naming convention,
Cell A2 should always be named "E" + the contents of A1
Examples:
Tab: Items | Cell A1: Item | Cell A2: EItem | Cell A3: None
Tab: Abilities | Cell A1: Ability | Cell A2: EAbility | Cell A3: None
Column A entries must:
Start with a capital letter.
Contain only letters, numbers, and underscores.
Be unique within the column.
Have exactly "None" as its Row 3 value.
Not use exactly "COUNT" as a value.
Not be a C# keyword or contextual keyword.
Not have any blank rows before the last entry.
Tab: Items
Tab: Abilities
Columns Create Data Accessors
Every non-blank cell in Row 1 creates a data accessor in the generated tab class.
Unlike for rows, there is no problem with having blank columns between columns with data in them.
The picture below demonstrates this situation, where it is ok to have a blank column.
If there is data in a column with no entry in Row 1, that data will not be accessible at runtime.
That can be useful if you need to use a column for calculations, but don't need it in your tab class.
Column Dropdowns
To add convenience and reduce errors when dealing with columns typed to enums,
it is advised to use Data Validation in Google Sheets to produce dropdowns for your enum typed columns.
The GHUD template defines Named Rages for each Column A and each NoTab column in the EnumsLoader tab.
The NoTab columns in the EnumsLoader tab function like Column A does in each data tab in 2 ways:
They generate an enum in the Unity project when you run GHUD's Get All Data function.
They define a Named Range in Google Sheets.
NoTabs are useful when you want to have an enum type available in Google Sheets,
but you don't need to make a whole tab for it.
You can edit the existing NoTab columns in the Sheets template,
or you can add a new NoTab column.
To add a new column:
Right-click the column letter
Click "+ Insert 1 column right"
Set the enum name in Row 2
enter the enum values in Rows 4 and below.
Whether new or edited, the Row 2 enum name must start with "E".
Row 3 must be exactly "None".
The entries in Row 4 and below must follow the same rules as Column A above.
If you change the enumn name of a NoTab or if you add a new NoTab,
you will need to run Utilities > Update Defined Named Ranges.
Note that running Update Tab Names, also runs Update Defined Named Ranges but not the other way around.
If this is your first time running a Utilities macro in your Google Sheets, you will need to authorize the sheet to run macros.
For instructions on macro authorization, see Updating Tab Names in Tab Expectations above.
To set up a dropdown column, follow this example where we set up an EFlavor dropdown for the Items tab to use.
Here we set both the Enum name "EFlavor" and some entries below it.
There is plenty of space for enum entries: 4,996 slots after None
Remember, after changing the enum name, you will need to run Utilities > UpdateDefined Named Ranges
Now the steps will be the same regardless of whether the enum came from a NoTab or a tab's Column A.
In the desired column, Set the variable name in Row 1, and the exact enum name in Row 2.
➠
Next we select the column we want to convert by clicking on Row 3 in that column, then press Ctrl+Shift+DownArrow twice.
It doesn't matter if Row 3 and below have data already or not, but if you have alternating blanks, you'll have to hit down more.
➠
➠
Figure A
With the column's entry data selected, Right-Click anywhere within the selected area.
Scroll to the bottom of the context menu, and click View more cell actions
Then Click the second option: Data validation
Click + Add rule
Next click the Criteria Dropdown, and select Dropdown (from a range).
➠
Figure B
Now enter "=" followed by the enum name in the box underneath the Dropdown (from a range) box.
The dropdown validation is now in place.
Close the Data validation rules window with the x on the top right.
Fill in the dropdowns by clicking on the 🞃 and selecting the desired entry.
You can also select the cell, start to type the value, then hit Tab to autocomplete the cell value.
To remove dropdowns, sellect all the dropdown cells you want to remove, and hit the delete key twice.
➠
➠
You can also automatically add enum dropdowns using the
Update Column Dropdowns for this Tab utility.
Just first make sure Row 2 has only valid type entries first.
Column Limit
You can add or remove columns on any data tab.
Each data tab can have up to 497 columns with non-blank values in Row 1.
If your tab class must have more than 497 accessors, see the Expanding Size Limitations page.
Row 1: Accessor Names
As described in Columns Create Class Properties above, Row 1 is used to define the variables within the tab class.
Because of that, it is important that entries in Row 1 follow C# property naming rules.
Row 1 entries must:
Start with a capital letter.
Contain only letters, numbers, and underscores.
Be unique within the row.
Have the singular form of the tab name as its Column A value.
Not be a C# keyword or contextual keyword.
Row 2: Accessor Types
Row 2 sets the type for the data accessor named in Row 1.
All data in each column needs to be interpretable as the type entered in Row 2.
The supported types are:
bool
byte
int
float
string
<enum>
All enums must begin with "E" and be at least 2 characters long.
Any enum used must be defined in either Column A of a data tab, or in a NoTab on the EnumsLoader tab.
You cannot use the enum type for an enum that exists in the Unity project, but not in Google Sheets.
See Column Dropdowns above for instructions on creating enums in NoTabs.
Row 3: Accessor Defaults
Row 3 is reserved for the default values used by the tab class accessor for the corresponding column.
Every Column with data in Row 1 must contain a valid default value in Row 3 based on the type defined in Row 2.
Supported data accessor types are:
bool ➠ false or ☐*
byte ➠ 0
int ➠ 0
float ➠ 0
string ➠ ="" or None
<enum> ➠ None
*It is recommended that checkbox data validation is used for bool typed columns.
To set up checkbox data validation,
follow the dropdown instructions in the Column Dropdowns instructions above,
starting with Figure A and ending with Figure B.
Then instead of setting the Criteria to Dropdown (from a range),
Scroll down to the bottom of the Criteria options, and select Checkbox
Then click Done and finally click the x at the top right of the Data validation rules.
The Row 3 values populate the accessors for the default "None" entry of each tab.
This data generally shouldn't be accessed in game, as it would typically be guarded with code similar to:
if (_example == EExample.None)
return;
Row 4 and Below: Data Entries
Row 4 and all rows below it are used for the actual data entries in the tab.
The value in Column A identifies the row and becomes an entry in the tab's generated enum.
See Column A accessor naming rules above in Column Expectations.
All values in each row must be interpretable as the data type defined for that column in Row 2.
Formatting
GHUD ignores formatting completely, so dropdowns, checkboxes, and conditional formatting are not required.
TRUE and FALSE can be used for bool values instead of ☑ and ☐ if so desired. (You can even use 1 for true, and 0 for false)
A row may reference another GHUD enum by using one of that enum's defined entries, such as Example0 in a column typed as EExample.
Blank Cells
GHUD will treat black cells as their default values by type:
bool ➠ false
byte ➠ 0
int ➠ 0
float ➠ 0f
string ➠ ""
<enum> ➠ None (Whatever the 0th enum is)
Restrictions
Rows may not be skipped. The last entry in Column A must have all cells above it filled with entry names.
Blank rows after the final data entry are allowed.
Data below the final data is allowed in columns outside Column A, but those values won't be accessible at runtime.
You can add or remove rows on any data tab whenever needed.
All tab rows, as well as the NoTab entries share a collective pool of roughly 5,000 rows of entries among them.
See the Expanding Size Limitations page for instructions on expanding the entry pool.