Convert XLS To CSV Files - Command Line Able

Convert Excel to CSV with/without MS Excel - Fast, easy and accurate

Batch Conversion of XLS Files to/from CSV, XLSX, Fixed Width Text, HTML, XML etc.


Fast Software

'Convert XLS' is 10-20 times faster than using Excel. It also allows for the saving and restoring of complex 'conversion jobs'. Specify a 'conversion job' within the command line or Windows scheduler and rest easy. 

'CONVERT XLS to CSV' — BATCH — 80x25
C:\>Working sample.bat files
   are installed for quick
   testing and customization.

C:\>Excel-to-CSV-Converter.bat

C:\>See detailed examples of
converting xls to csv by command line
at bottom of this page

Powerful Command Line

Power users: Command line capability is fundamental to ALL of our software tools. Demo batch files are installed ready for testing and modification. We are always here to help you implement our software.

Easy to use
File Conversion Features

Moving or deleting files while converting Excel files is no problem at all. This allows for easy, unattended conversion of whole folders. 

Convert Excel To CSV Files with 'Convert XLS'

'Convert XLS' Features


If you need to manipulate Excel, CSV, TXT file data, 'Convert XLS' comes with numerous features and specialized processes including:

General

Conversion Tool Extras
  • Convert up to 20 times faster when not using Excel.
  • Automate 'Convert XLS' using the command line or the COM/ActiveX interfaces.
  • Move or delete files after processing. Skip files already processed.
  • Save and restore complex conversion configurations.
  • Batch can be stopped midway and resumed at a later time.
  • Special processing of files including appending/concatenation, removing extra lines, search and replace strings and much more.
  • Can be adapted for all languages.
  • Launch (Run) a third party program

Excel Conversion

Excel Conversion Features
  • Specify:
    • Sheets to convert
    • Create a single or multiple files
    • Skip empty worksheets
    • Range to convert (e.g. "B4:J10")
    • Use double quotes
  • Convert Excel files to and from Text/CSV/HTML/XML without needing MS Excel to be installed.
  • XLSX Conversion supported. Convert XLSX to CSV, XLS, TXT, HTML, XML etc.
  • In most cases it is possible to retain leading zeroes (e.g. 0000123213012)

More info on specific Excel file conversions

CSV Conversion

Conversion and Manipulation of CSV File Data

    Many CSV manipulation features are included:

  • Surround field with quotes
  • Pad field with spaces
  • Change the delimitation character (e.g. from comma to tab)
  • Remove Empty Lines
  • Created Fixed Width Fields
  • Include specified ROWS, discard all others
  • Include specified COLUMNS, discard all others
  • Trim excess commas
  • Pad field(s) to a fixed length
  • Remove control characters

More info on specific CSV file conversions

Special Promotion: Buy 'Convert XLS' and get 'Convert Doc', 'Convert Image' and 'Convert PowerPoint' free!

Need a Tool for Converting XLS to CSV?

About 'Convert XLS'

NOTE: A CSV file can be any character delimited file, see CSV File Definition for details.

Do you need software to convert Excel To CSV (or convert CSV to Excel)? If so, we got just the tool you need. 'Convert XLS' can convert XLS to CSV (as well as XLSX, a fixed width text file, HTML or XML) 10 to 20 times faster than using MS Excel. You can specify the delimitation character used in your CSV file (typically a comma, but tab and | are popular too). Furthermore, Unicode and other text encodings (ASCII, ANSI, UTF8 etc.) are supported.

Our tool does not need MS Excel, although you can optionally specify to use it. This can assist in security for those planning on using a server.

All our conversion tools allow you to automate the process by using:

You can even move or delete the input files after conversion. Skipping files already processed is another popular feature that is included.

'Convert XLS's complete documentation is available on-line for review. Continue reading below for specific instructions on how to use the user interface and command line for converting Excel to csv files. Of course please do download it and try it for free.

Converting XLS to CSV

  • Run 'Convert XLS' then select the Convert Files Action To Do.
  • Select the input file path. For a whole folder be certain to use the *.ext format. For example if you want to convert the folder of xls files located in "C:\input folder\" then use "C:\input folder\*.xls".

    Select the 'Convert XLS' conversion method.

    If you are using the 'Convert XLS' conversion method, specify the Input File Format. In this case it is "Microsoft Excel Workbook (*.XLS)".

    Click on the Options button and choose the sheets, ranges and whether to include values or 'formulas and values' to convert. Also within the Options button select the "CSV, TSV…" tab to choose what character you are using to distinguish each piece of data within each record. By default the comma is used.
  • Specify the output file path. If you are doing a whole folder, then specify the whole folder using the "*.ext" format (for example "c:\Output\*.CSV"). Finally, specify the 'Convert To File Format' output file type. In this case it may be one of two choices, "Character Separated (*.CSV)" or "Character Separated Unicode (*.csv)". Note that you will have more choices available if you choose the 'MS Excel' conversion method.
  • Click the CONVERT button (or F5) on the tool bar to start converting.

Converting CSV to XLS

  • Run 'Convert XLS' then select the Convert Files Action To Do.
  • Select the input file path. For a whole folder use the *.ext format. For instance if you want to convert the folder of csv files located in "C:\input folder\" then use "C:\input folder\*.csv".

    Choose either 'Convert XLS' or 'MS Excel' conversion method. The 'Convert XLS' conversion method can be much faster than the 'MS Excel' conversion method. If you are using something other than a comma for the delimitation character pick the 'Convert XLS' conversion method.

    If you are using the 'Convert XLS' conversion method, specify the Input File Format. If using a CSV file, click on the Options button and then the "CSV, TSV…" tab to choose what character you want to distinguish each piece of data within each record of the csv file. By default the comma is used.
  • Specify the output file path. If you are doing a whole folder, then specify the whole folder using the "*.ext" format (e.g. "c:\Output\*.XLS"). Finally, specify the 'Convert To File Format' output file type. In this case it will be "Microsoft Excel Workbook (*.XLS)" or (*.XLSX).
  • Click the CONVERT button (or F5) on the tool bar to start converting.
Repeating the use of a 'Conversion Job' with 'Convert XLS'

If you click the ADD button, a 'Conversion Item' is added to the 'task list' at the bottom of the user interface.  You can add as many 'conversion tasks' as you want, and save the 'Conversion Job' file for use at a later time.  See the File menu for saving and restoring 'Conversion Jobs'.
'Convert XLS' can be especially helpful if you require complicated file conversion jobs done regularly. By saving and recalling a conversion job file, 'Convert XLS' quickly remembers all the file conversion tasks and their details.

Note: The same 'conversion job' file discussed above can be specified in the command line by using the /J switch. For example:
ConvertXLS.exe /J"C:\Conversion Jobs\Convert-XLS-to-CSV-Command-Line.SII"

It is the best XLS to CSV conversion tool you've never used... till today! Click here to download a free trial.


 Still not sure how to use it? See an online video. How to convert XLS To CSV files - Video



convert xls to csv command line

NOTE: After installation, you can find simple batch files (XLStoCSV.bat and XLSXtoCSV.bat) for quick and easy usage by going to Start\All Programs\Convert XLS\Example Batch Files. These will work without modification provided the installation was in the default folder. Email us at  if you have any questions or need additional examples. We will get you up and running fast!

Although we'll discuss the use of the command line here, it's only to give you a taste. For the full, accurate, and up to date information see the 'Convert XLS' command line documentation. If you have trouble running these examples see Helpful Hints For Creating a Command Line.


There are two approaches to using the command line:

  • Specify one or more conversion tasks in a conversion job
  • Specify a single conversion task in detail

A 'Conversion Job' is easily built using the 'Convert XLS' graphical user interface. All the details of the job are saved in a single conversion job file (e.g. 'c:\myjobs\Do-Multi-Step-Conversion.SII). Specifying a conversion job file with the command line is very easy by using the /J switch. You can have hundreds or thousands of tasks specified in the conversion job file, all of which will get executed in one fell swoop. For example:

ConvertXLS.EXE /J"D:\Job Files\Convert XLS to CSV.SII"


Specifying a single conversion task requires a bit more effort, but does not require the prior creation of a 'Conversion Job' file.
The first example below shows how to convert a single worksheet within an Excel file to the most popular form of a CSV file, a comma delimited file as well as a Tab Delimited File (TSV). It can be easily modified to convert from an Excel file to any character delimited CSV file. Also in the first example we'll show how to specify a specific range of cells within a sheet(s) to convert.
The second example shows how to convert multiple sheets within a single Excel file. Creating a single and multi-file output is illustrated.
The third and final example shows how to convert one or more sheets within many Excel files within a folder (and sub-folders).
Each switch shown in blue is described in detail at the bottom of this page. It is highly recommended you review each switches description before implementing the example, thereby giving you the full power of 'Convert XLS'.

Example 1: Convert XLS to CSV Command Line - Single Sheet

To convert a single XLS file, C:\in\B.XLS (Sheet named "LastSheet") to a comma delimited CSV file, C:\out\B.CSV using MS Excel conversion method, the following syntax would be used:

ConvertXLS.EXE /S"C:\in\B.XLS" /F-4143 /N"LastSheet" /T"C:\out\B.CSV" /C6 /M1 /V

To do the same using the 'Convert XLS' conversion method (extremely fast and MS Excel not required)  change the /M1 switch to /M2 as shown below:

ConvertXLS.EXE /S"C:\in\B.XLS" /F-4143 /N"LastSheet" /T"C:\out\B.CSV" /C6 /M2

If you want a tab (ASCII 9) delimited file instead of a comma delimited file adjust the /N switch:

ConvertXLS.EXE /S"C:\in\B.XLS" /F-4143 /N"LastSheet^^9" /T"C:\out\B.CSV" /C6 /M2

Change the 9 (tab character) in the example above to any character you want. Look at the ASCII chart for numeric character equivalents.

VERY IMPORTANT NOTE: Choosing the delimitation character is only possible when using the 'Convert XLS' (/M2) conversion method.

Building on the last example, say you want to specify a range, say A1:B10 within a sheet to convert. No problem, simply modify the /N switch as shown below:

ConvertXLS.EXE /S"C:\in\B.XLS" /F-4143 /N"LastSheet^A1:B10^9" /T"C:\out\B.CSV" /C6 /M2

Specifying ranges can be very powerful. For example if you want to only extract column N you can use "N:N" for the range.

Example 2: Convert XLS to CSV Command Line - Multiple Sheet Conversion

In example 1 we saw how the /N switch is used to specify the sheet/range to convert and what delimitation character to use in the character separated CSV file. Here we build upon that and show how to specify more than one sheet to convert.

To convert a single XLS file, C:\in\B.XLS (Sheets named "LastSheet","FirstSheet", and "MidSheet") to one CSV file, C:\Out\B.CSV, the following syntax would be used:

ConvertXLS.EXE /S"C:\in\B.XLS" /F-4143 /N"FirstSheet,LastSheet,MidSheet" /T"C:\Out\B.CSV" /C6 /M2

After completion of this example the following file will be created containing all the data of the 3 sheets specified:

 C:\Out\B.CSV

To create several output files you can add the /U switch like so:

ConvertXLS.EXE /S"C:\in\B.XLS" /F-4143 /N"FirstSheet,LastSheet,MidSheet" /T"C:\Out\B.CSV" /C6 /M2 /U

After completion the output would be several files:

C:\Out\B-FirstSheet.CSV

C:\Out\B-MidSheet.CSV

C:\Out\B-LastSheet.CSV

VERY IMPORTANT NOTE: The /U switch is only applicable to the 'Convert XLS' (/M2) conversion method. Using the 'MS Excel' (/M1) Conversion method always produces a multi-file output.

If FirstSheet, MidSheet, and LastSheet were indexed 1,2 and 4 respectively, the same results can be attained by setting /N To /N"1-2,4".

Example 3: Convert XLS to CSV Command Line - Multiple File/Folder Conversion

Say you wanted to convert the 2nd sheet (/N"2") regardless of what the sheet name might be, of all the XLS files within the "C:\in\" folder and sub-folders (/R for recursive sub-folders). To do this the syntax would be:

ConvertXLS.EXE /S"C:\in\*.XLS" /F-4143 /N"2" /T"C:\out\*.CSV" /C6 /M2 /R

The example above can be modified to have the resulting files placed in the same folder as the input files. By specifying the /G switch and removing the /T switch as shown below:

ConvertXLS.EXE /S"C:\in\*.XLS" /F-4143 /N"2" /G /C6 /M2 /R

In the last two examples, you can also use the /M1 switch to specify the 'MS Excel' conversion method.


Command Line Switches Used Above
  • The /S and /T switches above specify Source (input) and Output (output) path respectively and are both required when converting a single file. It is always a good idea to use double quotes around the path especially if there are space characters within the path.
  • The /C6 switch specifies that the output file to be a CSV file whereas the /F-4143 switch specifies the input file is a XLS file. See Excel Conversion File Type Constants for all possible values for /C and /F.
  • The /M2 switch tells it to use the 'Convert XLS' conversion method which is exceptionally fast. Note the /M1 switch could have been used to specify the 'MS Excel' conversion method which is a bit slower and requires MS Excel.
  • The /R switch tells it to search the input folder and its sub-folders for files to convert.
  • /G switch can be used to tell 'Convert XLS' to place each output file in the same folder as each input file.
  • /N"{Sheet^Range^DelimChar }" Is used when converting to/from an Excel, CSV or fixed width text file. It specifies which Sheets to convert, what Range to convert and what delimitation/separation character to use, and the method to import export to a fixed width text file. The syntax for this parameter is critical, the items are separated by a carrot character "^". If you do not include Sheet, Range or DelimChar by leaving them blank they will default to all sheets, all used ranges and the comma delimitation character. Be certain to include the double quotation character around this parameter like: /N"Apples,Oranges^A2:B20^9"

Sheet: Only used when an Excel file is the input file. Use "*" or "" for all sheets. You can use names of sheets, or the numeric index. If using numeric indices, you can specify ranges of sheets (i.e. "1,4,10-20" and "4-10,9" etc.). Range and DelimChar are optional.

Range: You could optionally specify a range, say if you only wanted to convert a portion of the input file. Use the same syntax as an Excel range (e.g. A1:B10).

DelimChar: is for specifying the ASCII value of the delimitation character used in a CSV file. 44 for comma, 124 for Bar "|", 9 for the tab etc.

FixedWidth: Here you can specify how to import/export a fixed width text file. Not used in this example.

  • /H If converting from XLS to something else and using the 'Convert XLS' conversion method (/M2) you can optionally specify to include values along with formula, much like "MS Excel" conversion method does.
  • /U If converting an XLS file with multiple sheets specified, the /U switch will generate multiple files instead of a single file.
  • The /V (for Verbose) switch is used to give instant feedback by having the program report the status of the conversion with a message box. You can remove this once you have perfected your command line specification. You can also (or instead of /V) create a Log file that will contain the results of the conversion by using the /L switch.

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.