Converting an Excel file to text

To read data from an Excel file, you must first convert the file to a text format that can be processed by template commands. This does not require installation of Microsoft Excel at a workstation.

GainSeeker provides a utility to open your Excel file and save it in the same folder as a new tab-delimited (.tab) or comma-separated (.csv) file. It does not delete the original Excel file.

This utility is named XLS2TXTN.exe . It is in the GainSeeker program files folder with SX.DLL, which must be present in the same folder as XLS2TXTN.exe for the program to properly function.

You can use the RUN or RUNANDWAIT template command to launch this utility with the necessary command line parameters.

Required command line parameters

file_path\filename.ext
 or  
"file path\file name.ext"

Specify the name and location of the Excel file to be converted. The Excel file can end with a three-character file name extension like ".xls" or a longer file name extension like ".xlsx" .

If the file path or filename contains a space, the entire path and file name should be surrounded by double-quotes (").

If the file path is not specified, GainSeeker will look for the specified file name in the folder where GainSeeker program files (*.exe) exist.

Optional command line parameters

By default, GainSeeker converts the first worksheet or the active worksheet in the Excel file (depending on your version of Excel), and the file will be converted to tab-delimited (.tab) format.

To convert multiple worksheets in a file, or to convert it to comma-separated (.csv) format, you can use these additional command line parameters:

-TAB

NOTE: If -TAB or -csv is not specified as a parameter, the program will use -TAB as the default export file type.

-s

This creates one text file for each worksheet. These files are named filename-1.ext, filename-2.ext, etc. – regardless of the names of the worksheets.

-csv

This parameter converts the Excel file to csv format instead of .tab format.

Note: You should only use this option if you are sure that your Excel file does not already contain any commas.

-

Examples

XLS2TXTN.exe F:\Quality\Data_05172007.xls

This will convert the first worksheet of F:\Quality\Data_05172007.xls to F:\Quality\Data_05172007.tab.

XLS2TXTN.exe "F:\ Quality\ My Data.xls" -s -csv

If "My data.xls" contains three worksheets, then this will convert the first worksheet to "My data-01.csv", the second to "My data-02.csv" and the third to "My data-03.csv".

Sample template formulas

RUNANDWAIT 'XLS2TXTN.exe F:\Quality\Data_05172007.xls'

This formula will convert the first worksheet of F:\Quality\Data_05172007.xls to F:\Quality\Data_05172007.tab.

RUNANDWAIT 'XLS2TXTN.exe "F:\ Quality\My Data.xls" -s -csv'

If "My data.xls" contains three worksheets, then this formula will convert the first worksheet to "My data-01.csv", the second to "My data-02.csv" and the third to "My data-03.csv".

Removing Line Feeds

If it is possible that a user may have pressed ALT+ENTER in an Excel cell to insert a line break within the cell, you can use a second GainSeeker utility (Txt2Nlf.exe) on the resulting .tab file or .csv file that will remove these Line Feed characters so that the text will be read correctly by the SPC Data Entry module.