Skip to content
Julian Halliwell edited this page Sep 17, 2021 · 1 revision

Creates a "chainable" version of the library which doesn't require the workbook currently being operated on to be passed into each call.

newChainable( [ existingWorkbookOrNewWorkbookType ] )

Optional arguments

  • existingWorkbookOrNewWorkbookType spreadsheet object OR string default="": An existing spreadsheet object (workbook), or the type of new workbook to create and operate on - possible values "xls", "xlsx", "streamingXlsx".

Note

If you don't pass an existing workbook or specify a new type, you will need to set up the workbook to operate on as the next call in the chain, for example using the .read(), .fromCsv() or .fromQuery() methods.

More details on chaining.

Example

spreadsheet.newChainable( "xlsx" )
  .addRows( data )
  .formatRow( { bold: true }, 1 )
  .write( filepath, true );
Clone this wiki locally