Skip to main content

Write to file

Save a table as a CSV file or as a JSON list of records, replacing the file.

Command in the Data Table toolkit · id ooa.datatable/write_to_file · 10 inputs (1 required), 1 output

Inputs​

InputTypeRequiredDefaultWhat it is
TableTableYesTable to save.
PathFileNoTarget file, e.g. output/report.csv; a folder keeps the file there; a temporary file in the run's folder when empty (G2, AA's file variable).
FormatStringNocsvcsv or json.
DelimiterStringNo,CSV delimiter (one character).
First row is the headerBooleanNotrueWrite the column names as the first CSV line.
EncodingStringNoutf-8Text encoding, e.g. utf-8, utf-8-bom, ansi (windows-1252), utf-16.
AppendBooleanNofalseAdd the rows to the end of an existing CSV file (no header is repeated).
Line endingStringNocrlfLine ending of CSV rows.
Row delimiterStringNoText written after each CSV row instead of the line ending, e.g. | or ;\n (\n, \r and \t are understood).
Create foldersBooleanNotrueCreate the file's folder when it does not exist; when off, a missing folder is an error.

Outputs​

OutputTypeWhat it is
pathFileFull path of the written file.