The spreadsheet format is as follows:

Spreadsheet Header Row(s)

The spreadsheet header comprises of at least one row, being the list of column names. This must be the first row in the spreadsheet, and each column name corresponds to the token name in the tmplate file.
A blank row must be left between the header row(s) and the rest of the spreadsheet. Any other header rows after the first (but before the blank seperating row) are ignored at this time.

Spreadsheet Data Rows

After the header, all subsequent rows are considered to be data rows. Empty data rows are ignored, as are any rows that do not have data in the first two cells. All other rows will be considered to represent configuration for a single machine and will be loaded into the ConfigGen program.

The first cell in a data row contains the machine name for which the configuration data of the row pertains. If this is empty, the entire row is ignored.
The second cell in the row contains the filename for the generated file (e.g. web.config). Note that this can be a relative path filename as well as a simple filename. If this cell is empty, the entire row is ignored.

All subsequent cells in the row are considered to hold configuration data.

Machine Name Config File Token1 Token2 Token3
blank blank blank blank blank
MachineOne App.Config Token1Value-ForMachineOne Token2Value-ForMachineOne Token3Value-ForMachineOne
MachineTwo App.Config Token1Value-ForMachineTwo Token2Value-ForMachineTwo Token3Value-ForMachineTwo
MachineThree App.Config Token1Value-ForMachineThree Token2Value-ForMachineThree Token3Value-ForMachineThree

Special Cell Values

The values in each cell in the spreadsheet are parsed by Excel before being read by ConfigGen. This means that the number 1 will be parsed as a number, whereas a cell with '1 (apostrophe one) will be parsed as a string. Similarly, the word true will be parsed as the boolean true, and converted into the value of 1 but a cell containing 'true (apostrophe true) will be parsed as the literal string "true".

In addition to the standard Excel parsing of cell values, there are certain values that have special meaning to ConfigGen:
  • An empty cell is taken to mean that no value is supplied for this combination of token (column) and machine (row);
  • The token value [EmptyString] is used to deliberately represent a value of an empty string for the combination of token and machine.

Note that both of the above two tokens represent a breaking change from v0.1 in which an empty cell was "coerced" to an empty string.
Additionally note that it is planned to make these special token values configurable rather than hard coded (e.g. so a different token value can be used to represent an empty string)

Last edited Oct 5, 2010 at 11:03 PM by rob_levine, version 7


No comments yet.