Skip to contents

Convenience wrapper around openxlsx::write.xlsx to handle some common formatting tasks:

  • Column headers are title-cased and bolded

  • Column widths are calculated based on the string representations of the data

  • Date columns are formatted as DATE instead of LONGDATE

And some optional additions:

  • Band columns by group

  • Specify currency columns

Usage

# S3 method for class 'xlsx_report'
write(report, report_data, columns = NULL, ...)

write_xlsx(
  data,
  filename = tempfile("write_xlsx", fileext = ".xlsx"),
  group = NULL,
  currency = NULL,
  overwrite = FALSE,
  ...
)

Arguments

report

report object

report_data

character(1) name of the field in report that contains the data

columns

list of named expressions mapping column names to their values, will be evaluated in the environment of attendance_report[[data]]

...

Arguments passed on to write_xlsx

data

data to write to the spreadsheet

filename

filename to write

group

character name of column to be used for grouping/banding the data. Band color will change when column value changes.

currency

character vector of column to be used for grouping/banding the data. Band color will change when column value changes.

overwrite

If TRUE, overwrite any existing file.

Value

filename of written xlsx

Functions

  • write(xlsx_report): report