addRow - cfsimplicity/spreadsheet-cfml GitHub Wiki
Adds a row to a spreadsheet.
addRow( workbook, data [, row [ , column [, insert [, delimiter [, handleEmbeddedCommas [, autoSizeColumns [, datatypes ] ] ] ] ] ] ] )
Required arguments
workbookspreadsheet objectdatastring OR array: Delimited list of data, one list item per column being added to the row. The default delimiter is a comma, but you can specify a different delimiter. (Version 2.1+) The data can be an array of values instead of a list.
Optional arguments
rownumeric: Row number at which to insert or replace the data. When inserting, existing rows below will be shifted down. If you omit this value, the row is inserted after the last row in the sheet.columnnumeric: The column at which to add the row data. Cells to the left of this column will be empty.insertboolean default=true: whether to insert the new data or replace existing values. If replacing (insert=false), you will need to specify therowto replace.delimiterstring default=",": the character separating cell values in your row. If your values contain commas, use an alternative delimiter not contained in your data, e.g. |handleEmbeddedCommasboolean default=true: whether to treat values enclosed in single quotes as a single element (to match ColdFusion). This only applies if the delimiter is a comma.autoSizeColumnsboolean default=false: whether to adjust the column widths automatically to fit the data added.datatypesstruct: specify data types as keys and the columns they should apply to in your data as an array of column names or (positional) numbers. These types will override the query column types or auto-detection where possible. Possible data type keys are:string,numeric,date,time,boolean,auto. See addRows() for examples.
Chainable? Yes.
Examples
spreadsheet = New spreadsheet();
workbook = spreadsheet.new();
spreadsheet.addRow( workbook, "a,b" );
// If your data contains commas, use a different delimiter
spreadsheet.addRow( workbook=workbook, data="Champion, the wonder horse|Bagpuss", delimiter="|" );
// Add data as an array
spreadsheet.addRow( workbook, [ "Champion, the wonder horse", "Bagpuss" ] );