convert

  • 20 Jan

    Converting XLS Files, Example 1

    http://limagito.com/converting-xls-files/

    First example: convert a xls(x) file to a tabbed txt file

    1) Add the following ‘Filename Include Filter’ so we are 100% sure we’ll only handle xls(x) files

    2) Add PS (Pascal Script) as Destination

    3) Add the following Pascal Script

    Const
    CsvPath = ‘C:\Test\OUT_XLS\’;
    Begin
    psExitCode := 0;
    // … add your code here
    // 2 = Text based file, #09 is tab delimited, 0 is UTF8 text encoded
    If psConvertXlsFile(psFilePath + psFileName, CsvPath + ChangeFileExt(psFileName, ‘.txt’), 2, #09, 0, ‘Run results’) Then
    Begin
    psExitCode := 1;
    psLogWrite(1, ”, ‘Converted ‘ + psFilePath + psFileName);
    End
    Else
    psLogWrite(1, ”, ‘Convert error ‘ + psFilePath + psFileName);

    // psConvertXlsFile(psFilePath + psFileName, CsvPath + ChangeFileExt(psFileName, ‘.csv’), 2, ‘,’, 0, ‘Run results’);
    End.

    By Limagito New Option , ,