Convert Excel to TXT - Command Line Able

Convert Excel to Fixed Width Text - Fast, easy and accurate

Batch Conversion of XLS, XLSX Files to TXT (ASCII and Unicode)


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. 

'CONVERT Excel to TXT' — BATCH — 80x25
C:\>Working demo.bat files
   are installed for quick
   testing and customization.

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

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

Powerful Command Line

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

Skipping files already converted while is no problem at all. Moving/deleting files already processed...check! These features allow for easy, unattended conversion of whole folders. 

Convert Excel to TXT Files with 'Convert XLS'

'Convert XLS' Features


If you need to manipulate Excel, TXT, CSV 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.
  • Skip files already processed. Move or delete files after processing.
  • 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
    • Range to convert (e.g. "B4:J10")
    • Create a single or multiple files
    • Skip empty worksheets
    • Use double quotes
  • Convert Excel files to Text/CSV/HTML/XML without needing MS Excel to be installed.
  • XLSX Conversion supported. Convert XLSX to TXT, CSV, XLS, HTML, XML etc.

More info on specific Excel file conversions

TXT Conversion

  • Conversion of Fixed Width Text Files
  • For each field/column specify:
    • Width
    • Padding character
    • Alignment
    • Re-order the columns to your specifications
    • Remove specific columns
  • Excel not needed making it lightning fast
  • Any number of 'fixed width profiles' can be specified for future use
  • Easily backup all your 'fixed width profiles'
  • Append text files together
  • In most cases it is possible to retain leading zeroes (e.g. 0000123213012)
  • Of course it is command line able

More info on specific Text file conversions

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

Need a Tool for Converting Excel to Text?

About 'Convert XLS'

Looking for software to convert Excel to Fixed Width Text Files?  Yes? Great, we have just the tool you need. 'Convert XLS' has a built in fixed width profile editor allowing you to specify:

  • Column widths
  • [Optional] Character used to pad the data (when there is empty space)
  • [Optional] Left/right alignment
  • [Optional] Skip/remove a column from the output file
  • [Optional] Reorder the column positions in the output file


The editor makes it easy to create numerous unique fixed width text profiles that can be recalled for use, modified or backed up at your command. We store each profile in a simple text file for easy archiving, editing etc.

'Convert XLS' can convert Excel to fixed width text files (as well as XLSX to TXT, CSV, XML, HTML) extremely fast and it does it without MS Excel. Converting from fixed width text file to Excel is also possible.

Note: We can handle HUGE text file sizes (gigabytes) without a problem. Unicode and other text encodings (ASCII, ANSI, UTF8 etc.) are supported.

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 text files. Of course please do download it and try it for free.

Fixed Width Profile Editor


Convert Excel to TXT profile editor image

Converting XLS to TXT

  • Run 'Convert XLS' then select the Convert Files Action To Do.

  • Select the 'Convert XLS' conversion method.

    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 Excel files located in "C:\source\" then use "C:\source\*.xls".

    Specify the Input File Format. In this case it may be one of the following:

    • (*.XLS) Excel Workbook
    • (*.XLSX) Open XML Excel Workbook
    • (*.XLSM) Excel Macro-Enabled Workbook

    Click on the Options button and then the Converting to/from a Fixed Width Text File tab and specify each column width (and optionally other attributes) for the output text file.
    Also, within the Excel tab, for the input workbooks, you may choose the sheets, ranges and other options.

  • 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\*.txt"). Finally, specify the "Convert To File Format" output file type, in this case it may be:

    • (*.TXT) ASCII
    • (*.TXT) Unicode
  • Click the CONVERT button (or F5) on the tool bar to start converting.

Converting XLSX to TXT

  • The directions are nearly identical to converting from XLS to TXT. Simply change the input file and file type selection to XLSX.
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 ran by simply double clicking on it within Windows Explorer. It can also be specified in the command line by using the /J switch. For example:
ConvertXLS.exe /J"C:\Conversion Jobs\Convert-Excel-to-TXT-Command-Line.SII"

It is simply the best Excel to TXT conversion app you've never used... till today! Click here to download a free trial.


 Still not sure about the user interface? See an online video. How to convert excel to txt files - Video



convert excel to txt command line

NOTE: After installation, you can find simple batch files (XLStoTXT.bat and XLSXtoTXT.bat) for quick and easy usage by going to Start\All Programs\Convert XLS\Example Batch Files. These will work immediately if the installation was done in the default folder.   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 TXT to XLS.SII"


Specifying a single conversion task requires a bit more effort, but does not require the prior creation of a 'Conversion Job' file. Everything that follows below will be about creating a 'conversion task' to convert from Excel to TXT by command line.

Note: If MS Excel says there is a problem with the output file see how to add the output folder as a trusted folder.


The first example shows how to convert from an Excel file(s) to a fixed width text file. In this example each column width can be specified since it uses the 'Convert XLS' conversion method (/M2). We also show how you can specify a range of cells to convert.

The second example shows how to convert from an Excel file to a fixed width text file using a column auto-sizing feature. This too requires the use of the 'Convert XLS' conversion method (/M2).

The last example shows how to use the 'MS Excel' conversion method (/M1) to convert from Excel to a fixed width text file.

All the examples below create an ASCII text file. To create Unicode text files, swap out /C21 with /C42. Furthermore, you can easily change the examples below to convert XLSX files by changing all instances of XLS to XLSX and changing all instances of /F-4143 to /F51.

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 TXT by Command Line

First specify your fixed width text file format using the Using the Fixed Width Text Profile Editor. You give a profile a name, in this case lets call it MyColumnWidths. To convert a sheet named "Apples" in a single Excel file, "C:\in\input.XLS" to a fixed width text file and applying the fixed width profile MyColumnWidths the following syntax would be used:


ConvertXLS.EXE /S"C:\in\input.XLS" /T "C:\out\out.txt" /C21 /F-4143 /M2 /N"Apples^^^2^MyColumnWidths" /V


Next we show how to convert a whole folder (and sub-folders /R) of XLS files (C:\in\*.XLS) to fixed width text files located in the same folder. We'll also show how to specify how to convert the 7th worksheet (/N) in each workbook. The following syntax would be used for such a case:


ConvertXLS.EXE /S"C:\in\*.XLS" /T "C:\in\*.txt" /C21 /F-4143 /M2 /N"7^^^2^MyColumnWidths" /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\*.XLS" /G /C21 /F-4143 /M2 /N"7^^^2^MyColumnWidths" /R /V


You may simply 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\*.XLS" /T "C:\Out\*.txt" /C21 /F-4143 /M2 /N"7^^^2^MyColumnWidths" /R /V


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


ConvertXLS.EXE /S"C:\in\*.XLS" /T "C:\Out\*.txt" /C21 /F-4143 /M2 /N"7^A1:B10^^2^MyColumnWidths" /R /V


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 TXT (Autosize Columns) by Command Line

This is identical to the first example of Example 1, however this time we don't specify each column width, rather, we allow 'Convert XLS' to automatically size the columns to fit all the data. Notice the only change is in the /N switch.


ConvertXLS.EXE /S"C:\in\input.XLS" /T "C:\out\out.txt" /C21 /F-4143 /M2 /N"Apples^^^0" /V


Of course the example immediately above can be adapted to do whole folders and sub-folders similar to what we did in Example 1.

Example 3: Convert XLS to TXT (Using 'MS Excel' Conversion Method) by Command Line

In this case we use the 'MS Excel' conversion method (/M1) to convert from a XLS file to a Fixed Width Text file. Notice that when using the 'MS Excel' conversion method we can't specify each column width and this will be a slower conversion.


ConvertXLS.EXE /S"C:\in\input.XLS" /T "C:\out\out.txt" /C21 /F-4143 /M1 /N"Apples^^" /V


Command line switches used to convert Excel to text

  • The /S and /T switches above specify Source (input) and Target (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 /C21 switch specifies that the target (output) file to be a fixed width text 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 and allows for the specification of each columns width. /M1 switch is 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^FixedWidth^Profile}" 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.

Sheet: 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: Not used in these examples. You could optionally specify a range; say if you only wanted to convert a portion of the input XLS file. Use the same syntax as an Excel range (e.g. A1:B10, B:B).

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: 'Convert XLS' Conversion Method only (/M2). Here you can specify how to import/export a fixed width text file. The following numeric values are valid:

0 = Auto size column widths to fit all data (Default)

1 = Use same widths as specified in the Excel file

2 = Use widths specified by the Profile. Widths can be specified in the user interfaces Fixed Width Text Profile Editor.

Profile = If you are specifying a fixed width text profile to use do it with this parameter. Use the Fixed Width Text Profile Editor to generate a profile. The full path to the txt file could be used. As an example if you want to specify to convert sheets called 'Apples' and 'Oranges', and use the range "A2:B20" and a fixed width text file profile named MyFixedWidth you would do so like this:

/N"Apples,Oranges^A2:B20^^2^MyFixedWidth"

  • 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.