Command Line to Convert CSV to XLS (Examples)

If you have trouble running these examples see Using the Command Line and Helpful Hints For Creating a Command Line.

NOTE: We've installed a handy batch file named CSVtoXLS.bat to help you test things easily. You can find it at Start\All Programs\Convert XLS\Example Batch Files. It's set to work right away if you've installed the software in the default location. For any queries or if you need more examples, just email us at support@softinterface.com. We're committed to helping you start smoothly and quickly!

NOTE: If Excel is giving you a warning about the output file, click here to see how you can make Excel trust the folder where this file is saved.

 

The first example demonstrates converting a common type of CSV file, which uses commas to separate data, into an Excel file. The second example covers the conversion of CSV files that use different delimiters (like tabs, bars, semicolons, etc.).

Each command line switch, highlighted in blue, is explained in detail below these examples. We strongly advise reviewing the descriptions of each switch before using the examples to fully leverage the capabilities of 'Convert XLS'.

Example 1 (Comma Delimited CSV File to XLS)

To convert a single comma delimited CSV file, "C:\in\input.CSV" to an Excel (XLS) file located in the "C:\Out\" folder, the following syntax would be used:

 

ConvertXLS.EXE /S"C:\in\input.CSV" /T "C:\Out\output.XLS" /C-4143 /F6 /M2 /V

To convert a whole folder (and sub-folders) of comma delimited CSV files, C:\in\*.CSV to XLS files located in the D:\Out\ folder, the following syntax would be used:

 

ConvertXLS.EXE /S"C:\in\*.CSV" /T "C:\out\*.XLS" /C-4143 /F6 /M2 /R /V

 

The /G switch can be used to tell 'Convert XLS' to place each output file in the same folder as each input file. Therefore the command line above is equivalent to the command line below:

 

ConvertXLS.EXE /S"C:\in\*.CSV" /G /C-4143 /F6 /M2 /R /V

 

You may want to convert a whole folder and its sub-folders and place the output into a separate folder/drive. In which case use this syntax:

 

ConvertXLS.EXE /S"C:\in\*.CSV" /T "C:\Out\*.XLS" /C-4143 /F6 /M2 /R /V

 

Example 2 (Any Character Delimited CSV File to XLS)

The next example can be adapted to convert any character delimited text (CSV) file. Say we have a bar "|" delimited text file that looks like this:

 

a1|b1|c1

a2|b2|c2

a3|b3|c3

 

Our goal is to convert it to an Excel (XLS) file. The bar character has an ASCII equivalent of 124 therefore they syntax would be like this:

 

ConvertXLS.EXE /S"C:\in\bar_delimited.txt" /T "C:\Out\Final.XLS" /C-4143 /F6 /M2 /N"^^124" /V

 

If we had a tab delimited file we would change the 124 in the above examples with ASCII equivalent of the tab character, 9. If you are not sure what the numeric equivalent of your separation character is, go to the Options button and click on the "CSV,TSV…" tab within the user interface. Of course the examples above can be adapted to do whole folders and sub-folders similar to what we did in Example 1.

 

Note: It is highly encouraged that you use the Verbose (/V) switch initially to see what the status of your conversion is and to help you perfect your command line. When in verbose mode the program will tell you what went wrong or right with your command line using message boxes.