Skip to content
Julian Halliwell edited this page Sep 20, 2021 · 3 revisions

Adds dropdown autofilters to the specified range of cells.

addAutofilter( workbook[, cellRange, row ] )

Required arguments

  • workbook spreadsheet object

Optional arguments

  • cellRange string: the cell range reference where the filters should appear in the form "A1:Z1"
  • row numeric default=1: if cellRange is missing or empty, apply the autofilters to this entire row

Chainable? Yes.

Notes

  • Autofilters are UI controls allowing the user to only show rows where the column contains the chosen value.
  • You set them on columns in one row only, normally the first.
  • If you don't specify a cell range or row, the autofilters will be applied to all columns in the first row.
  • The cellRange argument overrides any row specified.
  • Ranges containing multiple rows will ignore all but the first specified row.

Examples

data = QueryNew( "First,Last","VarChar,VarChar",[ [ "Susi","Sorglos" ],[ "Frumpo","McNugget" ] ] );
spreadsheet = New spreadsheet();
workbook = spreadsheet.workbookFromQuery( data );
spreadsheet.addAutofilter( workbook ); //apply to all columns in the first row
workbook2 = spreadsheet.workbookFromQuery( data );
spreadsheet.addAutofilter( workbook2, "A1" ); //apply just to the first column
Clone this wiki locally