Skip to content
Julian Halliwell edited this page Feb 25, 2015 · 14 revisions

Adds a row to a spreadsheet.

addRow( workbook, data[ row, column, insert, delimiter, handleEmbeddedCommas, autoSizeColumns ])

##Required arguments

  • workbook spreadsheet object
  • data string: 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.

##Optional arguments

  • row numeric: 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.
  • column numeric: The column at which to add the row data. Cells to the left of this column will be empty.
  • insert boolean default=true: whether to insert the new data or replace existing values. If replacing (insert=false), you will need to specify the row to replace.
  • delimiter string 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. |
  • handleEmbeddedCommas boolean 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.
  • autoSizeColumns boolean, default=false: whether to adjust the column widths automatically to fit the data added.

##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="|" );
Clone this wiki locally