Convenience helper that adds a worksheet to a global workbook object and writes either a single data frame, or a nested list of objects (data frames or other structures) in a readable layout.
add_sheet(name, df)Invisibly returns NULL. The workbook wb is
modified in place.
Character scalar; name of the worksheet to add.
Either a data frame to write directly, or a list whose
elements can be data frames, lists of data frames, or arbitrary
R objects. Non-data-frame objects are written using the output of
str().
This function assumes that a global wb object exists (an
openxlsx workbook). When df is a list, it iterates over
list elements and writes labeled sections for each element and its
sub-elements.
If df is NULL, a one-row data frame with the message
"Sin datos" is written.