| .write_sheet | R Documentation |
Helper to write a data frame into an openxlsx workbook as a table, replacing any existing sheet with the same name, applying basic formatting, and handling empty data frames gracefully.
.write_sheet(wb, sheet_name, df)
wb |
An |
sheet_name |
Character scalar; name of the worksheet to create or replace. |
df |
A data frame to write. If |
The function:
Removes the sheet sheet_name if it already exists.
Adds a new worksheet with that name.
Writes df as a data table and freezes the first row.
Sets column widths to "auto".
Applies a bold style to the header row.
Invisibly returns NULL. The workbook wb is
modified in place.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.