addFilter: Add column filters

Description Usage Arguments Details See Also Examples

View source: R/wrappers.R

Description

Add excel column filters to a worksheet

Usage

1
addFilter(wb, sheet, rows, cols)

Arguments

wb

A workbook object

sheet

A name or index of a worksheet

rows

A row number.

cols

columns to add filter to.

Details

adds filters to worksheet columns, same as filter parameters in writeData. writeDataTable automatically adds filters to first row of a table. NOTE Can only have a single filter per worksheet unless using tables.

See Also

writeData

addFilter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
wb <- createWorkbook()
addWorksheet(wb, "Sheet 1")
addWorksheet(wb, "Sheet 2")
addWorksheet(wb, "Sheet 3")

writeData(wb, 1, iris)
addFilter(wb, 1, row = 1, cols = 1:ncol(iris))

## Equivalently
writeData(wb, 2, x = iris, withFilter = TRUE)

## Similarly
writeDataTable(wb, 3, iris)
## Not run: 
saveWorkbook(wb, file = "addFilterExample.xlsx", overwrite = TRUE)

## End(Not run)

Example output

Note: zip::zip() is deprecated, please use zip::zipr() instead

openxlsx documentation built on June 16, 2021, 9:06 a.m.