The Excel to CSPro can be run from the command line, either in an automated way or by bringing up a specification file for modification. Assuming that CSPro was installed to the default directory, the tool is likely found here:
"C:\Program Files (x86)\CSPro 7.1\Excel2CSPro.exe"
If you want to open a specification file, simply provide it as the argument to the tool, as in:
"C:\Program Files (x86)\CSPro 7.1\Excel2CSPro.exe" "My Specifications File.xs2cs"
If you want to open the specification file, run the conversion, and close the tool, use the /run argument:
"C:\Program Files (x86)\CSPro 7.1\Excel2CSPro.exe" /run "My Specifications File.xs2cs"
If you only want to overwrite the CSPro data file if the Excel file is newer than the CSPro data file, then you can substitute the /run argument with /runifnewer.
It is possible to override the parameters in specification files. Parameters include the names of the files, the starting row for conversion, and the record and item mappings. As Excel to CSPro processes a specification file, it takes the first entry for a file or mapping. In the example below, the input spreadsheet will be Virginia.xlsx:
Parameters specified on the command line are considered before the contents of a specification file. For example, to run the above conversion from the command line on a file called "North Carolina.xlsx":
"C:\Program Files (x86)\CSPro 7.1\Excel2CSPro.exe" /run "My Specifications File.xs2cs" "Excel=North Carolina.xlsx"
If you had a spreadsheet with two worksheets, Asia and Europe, with the same column specifications, you could use the tool to map the CSPro records and items to one worksheet and then process them using a batch script:
"C:\Program Files (x86)\CSPro 7.1\Excel2CSPro.exe" /run "Eurasia.xs2cs" "OutputData=Asia.csdb" "Mapping=POPULATION_DATA_REC;;Asia"
"C:\Program Files (x86)\CSPro 7.1\Excel2CSPro.exe" /run "Eurasia.xs2cs" "OutputData=Europe.csdb" "Mapping=POPULATION_DATA_REC;;Europe"
In the specification file and overrides, the following commands are available:
|Excel=||Specifies the input Excel file.|
|InputDict=||Specifies the CSPro dictionary.|
|OutputData=||Specifies the name of the output data file. The extension of the file indicates the output is a CSPro DB file or a text file.|
|StartingRow=||Specifies the starting row where the data is located.|
|Mapping=||Specifies a mapping between a dictionary record and an Excel worksheet or a dictionary item and an Excel column.|
Dictionary record to worksheet mappings take the form:
@1 as an index meaning that this is the first worksheet in the spreadsheet. People is the name of the worksheet. When processing mappings, Excel to CSPro first tries to find the worksheet using the name. If the name is not present, then the index is used. When overriding values, you can provide either a name, an index, or both.
Dictionary item to column mappings take the form:
Item mappings list only the column number in the worksheet that corresponds to the item. Mapped ID items must be prefaced with the record name, as in: