export_excel | R Documentation |
Exports Excel sheets with table formatting, headers, auto-column width, etc. Currently does not auto-size columns with dates correctly.
export_excel(
df,
tab_name,
file_name,
type = "new",
col_width = "auto",
tab_color = NULL,
table_name = NULL,
show_tab = TRUE,
save = TRUE
)
df |
A data frame, will be exported as an Excel table |
tab_name |
A string, the name to give to the exported sheet |
file_name |
A string, the name of the file to be created |
type |
"new" or "existing", whether to export the sheet as a new stand-alone file (default), or as an addition to an existing file |
col_width |
optional (defaults to 'auto'), either 'auto' for autosized columns or a vector of numbers which must be equal to the number of columns |
tab_color |
optional (defaults to none), hex color or color from colors() |
table_name |
optional (defaults to Table3, Table4, etc.), unique table name in workbook; useful for writing Excel formulas that reference sheets on different tabs |
show_tab |
optional (defaults to TRUE), whether the sheet exported is shown or hidden |
save |
optional (defaults to TRUE), whether to save the final Excel workbook; not saving the workbook allows for additional, more complex openxlsx changes, |
A new .xlsx file or a new sheet in an existing .xlsx file
Jeremy Pesner, Lillian Nguyen
export_excel_tabs
export_excel(iris, "Iris Data","iris.xlsx", "new")
# if using option to resize columns
export_excel(iris, "Iris Data","iris.xlsx", "new", rep(15, 5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.