Writes the active sheet of a spreadsheet workbook to a CSV file. Fields containing the delimiter, a quote or a newline are quoted, with embedded quotes doubled. The fluent member form is writeToCsv(filePath, delimiter) (alias writeCsv).
spreadsheetWriteToCsv(spreadsheetObj, filePath [, delimiter])
→ returns any
,Build a small workbook and write it to a CSV file.
wb = Spreadsheet("xlsx");
spreadsheetAddRow(wb, "name,score", 1, 1, false);
spreadsheetAddRow(wb, "Alice,90", 2, 1, false);
spreadsheetWriteToCsv(wb, expandPath("/out.csv"));
writeDump(fileRead(expandPath("/out.csv")));
Expected Result: name,score Alice,90
Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.