Skip to main content

Data Types

How types are determined

To avoid parsing issues in applications consuming the data, Starsheet will automatically infer the data type of a particular field based on all the values of that column. For example, if an entire column only contains numeric values (or null/empty values) the data will be output as a number, but if it contains a mix of numeric values and strings, all instances of that field will be output of strings. The exception to this is when a sheet has been set to be output as key-value pairs, which causes the type of each item to be evaluated independently.

Booleans

The following values are acceptable as booleans and will be converted to a boolean true or false in the output:
  • A Ticked or Unticked Checkbox
  • The string Y or N
  • The string 1 or 0
  • The string TRUE or FALSE
  • When combined exclusively with the above “truthy” values, a null/empty value will be interpreted as false

Arrays

Multiple columns can be combined into an array, by using the same column title suffixed with square brackets ([]). For example a sheet with the following structure: Would produce this output:

Objects

To output fields as objects, add periods to the column title to indicate how they should be nested. For example a sheet with the following structure: Would produce this output:

Excluding Data from Output

Hiding Worksheets or Columns

To prevent a worksheet or column from being included in the output, prefix the column name or worksheet name with a # symbol.

Hiding Rows

To hide a row, create a column with the heading !hide and set it to a true value. A checked tickbox, 1, TRUE or Y are all treated as true. Alternatively, to hide all rows by default, add a column with the heading !show. All rows that don’t have a true value in this column will be hidden.

Modifying JSON Document Format

Outputting a Worksheet as objects indexed by a key

By default, a worksheet is outputted in JSON as an array of objects.

Default Output

If you would prefer it to be output as an object, indexed by a key add a column with the title !id. The value of this field will be used as the key.

Modified output using !id field

Outputting a Worksheet as Key-Value Pairs

If a worksheet only contains two columns with the titles !key and !value they will be output in the following format. You may still use non-outputted columns such as a commented column or !hide in worksheets using this format.