Creates a new spreadsheet workbook and is the entry point to the fluent builder API. Passing "xlsx" (the default) or "xls" selects the workbook format; mutating methods on the returned workbook return the same object, so calls can be chained. Terminal reads such as getCellValue(), info() or toQuery() return data.
spreadsheet([typeOrPath])
→ returns any
xlsxxlsxxlsBuild a workbook with a query, a formatted header row and a frozen pane, then write it to disk.
people = queryNew("id,name", "integer,varchar");
queryAddRow(people, {id: 1, name: "Alice"});
Spreadsheet("xlsx")
.renameSheet("People", 1)
.addRows(people, 1, 1, true)
.formatRow({ bold: true, bgcolor: "#dfe6e9" }, 1)
.addFreezePane(0, 1)
.write(expandPath("/people.xlsx"), true);
Create an empty workbook and use the Spreadsheet* function form on it.
wb = Spreadsheet();
spreadsheetSetCellValue(wb, "Hello", 1, 1);
writeDump(spreadsheetGetCellValue(wb, 1, 1));
Expected Result: Hello
Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.