UmyaSpreadsheet.CSVFunctions (umya_spreadsheet_ex v0.7.0)
View SourceFunctions for exporting spreadsheets to CSV format.
Summary
Functions
Exports a sheet to CSV format with default options.
Exports a sheet to CSV format with custom options.
Exports a sheet to CSV format with custom options.
Functions
Exports a sheet to CSV format with default options.
Parameters
spreadsheet
- The spreadsheet structsheet_name
- The name of the sheet to exportpath
- The output path for the CSV file
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
:ok = UmyaSpreadsheet.CSVFunctions.write_csv(spreadsheet, "Sheet1", "output.csv")
Exports a sheet to CSV format with custom options.
Parameters
spreadsheet
- The spreadsheet structsheet_name
- The name of the sheet to exportpath
- The output path for the CSV fileoptions
- A map of CSV writer options with the following fields::encoding
- The character encoding to use (default: "UTF8"):delimiter
- The field delimiter (default: ","):do_trim
- Whether to trim whitespace (default: false):wrap_with_char
- Character to wrap fields with (default: "")
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
options = %{
encoding: "UTF8",
delimiter: ";",
do_trim: true,
wrap_with_char: """
}
:ok = UmyaSpreadsheet.CSVFunctions.write_csv(spreadsheet, "Sheet1", "output.csv", options)
Exports a sheet to CSV format with custom options.
Parameters
spreadsheet
- The spreadsheet structsheet_name
- The name of the sheet to exportpath
- The output path for the CSV fileoptions
- A map of CSV writer options with the following fields::encoding
- The character encoding to use (default: "UTF8"):delimiter
- The field delimiter (default: ","):do_trim
- Whether to trim whitespace (default: false):wrap_with_char
- Character to wrap fields with (default: "")
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
options = %{
encoding: "UTF8",
delimiter: ";",
do_trim: true,
wrap_with_char: """
}
:ok = UmyaSpreadsheet.CSVFunctions.write_csv_with_options(spreadsheet, "Sheet1", "output.csv", options)