I recently had to create a file with the contents of two columns from a spreadsheet. When I could not find an XL function to do that, I ended up doing it the hard way, but it made me think how convenient a function would be.
Here is my code:
Code: Select all
XLSheetToArray>%SpreadsheetFile%,Sheet1,vFieldName
Let>vRow=1
Repeat>vRow
Let>vRow=vRow+1
// Set values for columns 1,4
Let>vColumn1=vFieldName_%vRow%_1
Let>vColumn4=vFieldName_%vRow%_4
WriteLn>Path\OutputFile.txt,vResult,%vColumn1%;;;%vColumn4%
Until>vRow=%vFieldName_count%
XLSheetToFile>ExcelFile,Sheet,{Rows/Columns},Delim,OutputFile,Result,
Syntax:
Excel file = Path\FileName of source file
Sheet = SheetName or Number
Rows/Columns ="All","R/C #-# or #,#,#,#" or "RangeName" to be exported
Delim = Column delimiter ( comma, space, semicolon, quotes, tab, other)
OutputFile =Path\FileName of destination file.
Result = 1 for successful export, 0 for failure.
This would be the command for the code sample I showed above:
Code: Select all
XLSheetToFile>%SpreadsheetFile%,Sheet2,{C1,4},;,%OutputFile%,vResult