Write Table to File
Verb: writeTableToFile
Available from: <Standard>
Writes a data table on a text file.
Syntax
writeTableToFile [--addHeaders(Boolean)] [--fromRow(Numeric)] --delimiter(TextDelimiterOption) --characters(String) --lengths(List<Numeric>) [--path(String)] --dataTable(DataTable) (String)=value
Inputs
| Script | Designer | Required | AcceptedTypes | Description |
|---|---|---|---|---|
| --addHeaders | Add Header | Optional | Boolean | When enabled, the name of each column is written on the first row of the table. |
| --fromRow | From Row | Optional | Number | Defines the line of the spreadsheet from which the table begins to be retrieved. |
| --delimiter | Delimiter | Required | TextDelimiterOption | Delimiter type used to separate the table columns. The following options for delimitation are available:
|
| --characters | Separator | Only whenDelimiter is ByCharacters | Text | Character used as a separator in each column of the table. |
| --lengths | Length | Only whenDelimiter is ByLengths | List<Number>, Text | List with the length, in characters, of each column. These characters can be used with a list of numbers, or in a sequence with numbers separated by commas, such as: "1,2,3". |
| --path | Path | Optional | Text | File path where the data table is written.
If it is blank, a random path is generated in the "temp" folder on the hard drive. |
| --dataTable | Data Table | Required | Data Table | Data table that will be written in the text file. |
Outputs
| Script | Designer | AcceptedTypes | Description |
|---|---|---|---|
| value | Path | Text | Path of the file in which the text was written. |
Example
The Write Table to File command does the following action: writes a data table on a text file, not going over fifteen characters per column, unless there are already over fifteen characters on the column.
defVar --name excelFile --type Excel
defVar --name excelTable --type DataTable
defVar --name filePath --type String
// Download the following file to execute the command.
excelOpen tableExcelCompanyCity.xlsx excelFile=value
excelGetTable --file ${excelFile} --getfirstsheet --entiretable tabelaExcel=value
writeTableToFile --addHeaders --delimiter "ByLengths" --lengths "15,3" --dataTable ${excelTable} filePath=value
logMessage --message "Caminho: ${filePath}" --type "Info"