A workbook
sheet_namessheet_names
calcChaincalcChain
chartscharts
is_chartsheetis_chartsheet
customXmlcustomXml
connectionsconnections
ctrlPropsctrlProps
Content_TypesContent_Types
appapp
corecore
customcustom
drawingsdrawings
drawings_relsdrawings_rels
embeddingsembeddings
externalLinksexternalLinks
externalLinksRelsexternalLinksRels
headFootheadFoot
mediamedia
metadatametadata
personspersons
pivotTablespivotTables
pivotTables.xml.relspivotTables.xml.rels
pivotDefinitionspivotDefinitions
pivotRecordspivotRecords
pivotDefinitionsRelspivotDefinitionsRels
queryTablesqueryTables
slicersslicers
slicerCachesslicerCaches
sharedStringssharedStrings
styles_mgrstyles_mgr
tablestables
tables.xml.relstables.xml.rels
themetheme
vbaProjectvbaProject
vmlvml
vml_relsvml_rels
commentscomments
threadCommentsthreadComments
workbookworkbook
workbook.xml.relsworkbook.xml.rels
worksheetsworksheets
worksheets_relsworksheets_rels
sheetOrderThe sheet order. Controls ordering for worksheets and worksheet names.
pathpath
creatorA character vector of creators
titletitle
subjectsubject
categorycategory
datetimeCreatedThe datetime (as POSIXt) the workbook is
created. Defaults to the current Sys.time() when the workbook object
is created, not when the Excel files are saved.
new()Creates a new wbWorkbook object
wbWorkbook$new(
creator = NULL,
title = NULL,
subject = NULL,
category = NULL,
datetime_created = Sys.time(),
theme = NULL,
...
)creatorcharacter vector of creators. Duplicated are ignored.
titletitle
subjectsubject
categorycategory
datetime_createdThe datetime (as POSIXt) the workbook is
created. Defaults to the current Sys.time() when the workbook object
is created, not when the Excel files are saved.
themeOptional theme identified by string or number
...additional arguments
a wbWorkbook object
append()Append a field. This method is intended for internal use
wbWorkbook$append(field, value)fieldA valid field name
valueA value for the field
append_sheets()Append to self$workbook$sheets This method is intended for internal use
wbWorkbook$append_sheets(value)valueA value for self$workbook$sheets
validate_sheet()validate sheet
wbWorkbook$validate_sheet(sheet)sheetA character sheet name or integer location
The integer position of the sheet
add_chartsheet()Add a chart sheet to the workbook
wbWorkbook$add_chartsheet(
sheet = next_sheet(),
tab_color = NULL,
zoom = 100,
visible = c("true", "false", "hidden", "visible", "veryhidden"),
...
)sheetsheet
tab_colortab_color
zoomzoom
visiblevisible
......
The wbWorkbook object, invisibly
add_worksheet()Add worksheet to the wbWorkbook object
wbWorkbook$add_worksheet(
sheet = next_sheet(),
grid_lines = TRUE,
row_col_headers = TRUE,
tab_color = NULL,
zoom = 100,
header = NULL,
footer = NULL,
odd_header = header,
odd_footer = footer,
even_header = header,
even_footer = footer,
first_header = header,
first_footer = footer,
visible = c("true", "false", "hidden", "visible", "veryhidden"),
has_drawing = FALSE,
paper_size = getOption("openxlsx2.paperSize", default = 9),
orientation = getOption("openxlsx2.orientation", default = "portrait"),
hdpi = getOption("openxlsx2.hdpi", default = getOption("openxlsx2.dpi", default = 300)),
vdpi = getOption("openxlsx2.vdpi", default = getOption("openxlsx2.dpi", default = 300)),
...
)sheetsheet
grid_linesgridLines
row_col_headersrowColHeaders
tab_colortabColor
zoomzoom
headerheader
footerfooter
odd_headeroddHeader
odd_footeroddFooter
even_headerevenHeader
even_footerevenFooter
first_headerfirstHeader
first_footerfirstFooter
visiblevisible
has_drawinghasDrawing
paper_sizepaperSize
orientationorientation
hdpihdpi
vdpivdpi
......
The wbWorkbook object, invisibly
clone_worksheet()Clone a workbooksheet
wbWorkbook$clone_worksheet(old = current_sheet(), new = next_sheet())oldname of worksheet to clone
newname of new worksheet to add
add_data()add data
wbWorkbook$add_data(
sheet = current_sheet(),
x,
dims = wb_dims(start_row, start_col),
start_col = 1,
start_row = 1,
array = FALSE,
col_names = TRUE,
row_names = FALSE,
with_filter = FALSE,
name = NULL,
sep = ", ",
apply_cell_style = TRUE,
remove_cell_style = FALSE,
na.strings = na_strings(),
inline_strings = TRUE,
...
)sheetsheet
xx
dimsdims
start_colstartCol
start_rowstartRow
arrayarray
col_namescolNames
row_namesrowNames
with_filterwithFilter
namename
sepsep
apply_cell_styleapplyCellStyle
remove_cell_styleif writing into existing cells, should the cell style be removed?
na.stringsValue used for replacing NA values from x. Default
na_strings() uses the special #N/A value within the workbook.
inline_stringswrite characters as inline strings
...additional arguments
returnThe wbWorkbook object
add_data_table()add a data table
wbWorkbook$add_data_table(
sheet = current_sheet(),
x,
dims = wb_dims(start_row, start_col),
start_col = 1,
start_row = 1,
col_names = TRUE,
row_names = FALSE,
table_style = "TableStyleLight9",
table_name = NULL,
with_filter = TRUE,
sep = ", ",
first_column = FALSE,
last_column = FALSE,
banded_rows = TRUE,
banded_cols = FALSE,
apply_cell_style = TRUE,
remove_cell_style = FALSE,
na.strings = na_strings(),
inline_strings = TRUE,
...
)sheetsheet
xx
dimsdims
start_colstartCol
start_rowstartRow
col_namescolNames
row_namesrowNames
table_styletableStyle
table_nametableName
with_filterwithFilter
sepsep
first_columnfirstColumn
last_columnlastColumn
banded_rowsbandedRows
banded_colsbandedCols
apply_cell_styleapplyCellStyle
remove_cell_styleif writing into existing cells, should the cell style be removed?
na.stringsValue used for replacing NA values from x. Default
na_strings() uses the special #N/A value within the workbook.
inline_stringswrite characters as inline strings
...additional arguments
The wbWorkbook object
add_pivot_table()add pivot table
wbWorkbook$add_pivot_table(
x,
sheet = next_sheet(),
dims = "A3",
filter,
rows,
cols,
data,
fun,
params
)xa wb_data object
sheeta worksheet
dimsthe worksheet cell where the pivot table is placed
filtera character object with names used to filter
rowsa character object with names used as rows
colsa character object with names used as cols
dataa character object with names used as data
funa character object of functions to be used with the data
paramsa list of parameters to modify pivot table creation
fun can be either of AVERAGE, COUNT, COUNTA, MAX, MIN, PRODUCT, STDEV,
STDEVP, SUM, VAR, VARP
The wbWorkbook object
add_formula()add formula
wbWorkbook$add_formula(
sheet = current_sheet(),
x,
dims = wb_dims(start_row, start_col),
start_col = 1,
start_row = 1,
array = FALSE,
cm = FALSE,
apply_cell_style = TRUE,
remove_cell_style = FALSE,
...
)sheetsheet
xx
dimsdims
start_colstartCol
start_rowstartRow
arrayarray
cmcm
apply_cell_styleapplyCellStyle
remove_cell_styleif writing into existing cells, should the cell style be removed?
...additional arguments
The wbWorkbook object
add_style()add style
wbWorkbook$add_style(style = NULL, style_name = NULL)stylestyle
style_namestyle_name
The wbWorkbook object
to_df()to_df
wbWorkbook$to_df(
sheet,
start_row = 1,
start_col = NULL,
row_names = FALSE,
col_names = TRUE,
skip_empty_rows = FALSE,
skip_empty_cols = FALSE,
skip_hidden_rows = FALSE,
skip_hidden_cols = FALSE,
rows = NULL,
cols = NULL,
detect_dates = TRUE,
na.strings = "#N/A",
na.numbers = NA,
fill_merged_cells = FALSE,
dims,
show_formula = FALSE,
convert = TRUE,
types,
named_region,
keep_attributes = FALSE,
...
)sheetEither sheet name or index. When missing the first sheet in the workbook is selected.
start_rowfirst row to begin looking for data.
start_colfirst column to begin looking for data.
row_namesIf TRUE, the first col of data will be used as row names.
col_namesIf TRUE, the first row of data will be used as column names.
skip_empty_rowsIf TRUE, empty rows are skipped.
skip_empty_colsIf TRUE, empty columns are skipped.
skip_hidden_rowsIf TRUE, hidden rows are skipped.
skip_hidden_colsIf TRUE, hidden columns are skipped.
rowsA numeric vector specifying which rows in the Excel file to read. If NULL, all rows are read.
colsA numeric vector specifying which columns in the Excel file to read. If NULL, all columns are read.
detect_datesIf TRUE, attempt to recognize dates and perform conversion.
na.stringsA character vector of strings which are to be interpreted as NA. Blank cells will be returned as NA.
na.numbersA numeric vector of digits which are to be interpreted as NA. Blank cells will be returned as NA.
fill_merged_cellsIf TRUE, the value in a merged cell is given to all cells within the merge.
dimsCharacter string of type "A1:B2" as optional dimensions to be imported.
show_formulaIf TRUE, the underlying Excel formulas are shown.
convertIf TRUE, a conversion to dates and numerics is attempted.
typesA named numeric indicating, the type of the data. 0: character, 1: numeric, 2: date, 3: posixt, 4:logical. Names must match the returned data
named_regionCharacter string with a named_region (defined name or table). If no sheet is selected, the first appearance will be selected.
keep_attributesIf TRUE additional attributes are returned. (These are used internally to define a cell type.)
...additional arguments
a data frame
load()load workbook
wbWorkbook$load(file, sheet, data_only = FALSE, calc_chain = FALSE, ...)filefile
sheetsheet
data_onlydata_only
calc_chaincalc_chain
...additional arguments
The wbWorkbook object invisibly
save()Save the workbook
wbWorkbook$save(file = self$path, overwrite = TRUE, path = NULL)fileThe path to save the workbook to
overwriteIf FALSE, will not overwrite when path exists
pathDeprecated argument previously used for file. Please use file in new code.
The wbWorkbook object invisibly
interactiveIf FALSE will throw a warning and not open the path.
This can be manually set to TRUE, otherwise when NA (default) uses
the value returned from base::interactive()
minor helper wrapping xl_open which does the entire same thing
The wbWorkbook, invisibly
buildTable()Build table
wbWorkbook$buildTable(
sheet = current_sheet(),
colNames,
ref,
showColNames,
tableStyle,
tableName,
withFilter,
totalsRowCount = 0,
showFirstColumn = 0,
showLastColumn = 0,
showRowStripes = 1,
showColumnStripes = 0
)sheetsheet
colNamescolNames
refref
showColNamesshowColNames
tableStyletableStyle
tableNametableName
withFilterwithFilter
totalsRowCounttotalsRowCount
showFirstColumnshowFirstColumn
showLastColumnshowLastColumn
showRowStripesshowRowStripes
showColumnStripesshowColumnStripes
The wbWorksheet object, invisibly
update_table()update a data_table
wbWorkbook$update_table(sheet = current_sheet(), dims = "A1", tabname)sheeta worksheet
dimscell used as start
tabnamea tablename
The wbWorksheet object, invisibly
copy_cells()copy cells around in a workbook
wbWorkbook$copy_cells(
sheet = current_sheet(),
dims = "A1",
data,
as_value = FALSE,
as_ref = FALSE,
transpose = FALSE
)sheeta worksheet
dimscell used as start
dataa wb_data object
as_valueshould a copy of the value be written
as_refshould references to the cell be written
transposeshould the data be written transposed
The wbWorksheet object, invisibly
get_base_font()Get the base font
wbWorkbook$get_base_font()A list of of the font
set_base_font()Get the base font
wbWorkbook$set_base_font(
font_size = 11,
font_color = wb_color(theme = "1"),
font_name = "Calibri",
...
)font_sizefontSize
font_colorfont_color
font_namefont_name
......
The wbWorkbook object
set_bookview()Set the book views
wbWorkbook$set_bookview(
active_tab = NULL,
auto_filter_date_grouping = NULL,
first_sheet = NULL,
minimized = NULL,
show_horizontal_scroll = NULL,
show_sheet_tabs = NULL,
show_vertical_scroll = NULL,
tab_ratio = NULL,
visibility = NULL,
window_height = NULL,
window_width = NULL,
x_window = NULL,
y_window = NULL,
...
)active_tabactiveTab
auto_filter_date_groupingautoFilterDateGrouping
first_sheetfirstSheet
minimizedminimized
show_horizontal_scrollshowHorizontalScroll
show_sheet_tabsshowSheetTabs
show_vertical_scrollshowVerticalScroll
tab_ratiotabRatio
visibilityvisibility
window_heightwindowHeight
window_widthwindowWidth
x_windowxWindow
y_windowyWindow
...additional arguments
The wbWorkbook object
get_sheet_names()Get sheet names
wbWorkbook$get_sheet_names()A named character vector of sheet names in their order. The
names represent the original value of the worksheet prior to any
character substitutions.
set_sheet_names()Sets a sheet name
wbWorkbook$set_sheet_names(old = NULL, new)oldOld sheet name
newNew sheet name
The wbWorkbook object, invisibly
set_row_heights()Sets a row height for a sheet
wbWorkbook$set_row_heights(
sheet = current_sheet(),
rows,
heights = NULL,
hidden = FALSE
)sheetsheet
rowsrows
heightsheights
hiddenhidden
The wbWorkbook object, invisibly
remove_row_heights()Sets a row height for a sheet
wbWorkbook$remove_row_heights(sheet = current_sheet(), rows)sheetsheet
rowsrows
The wbWorkbook object, invisibly
description
creates column object for worksheet
createCols()wbWorkbook$createCols(sheet = current_sheet(), n, beg, end)sheetsheet
nn
begbeg
endend
group_cols()Group cols
wbWorkbook$group_cols(
sheet = current_sheet(),
cols,
collapsed = FALSE,
levels = NULL
)sheetsheet
colscols
collapsedcollapsed
levelslevels
The wbWorkbook object, invisibly
ungroup_cols()ungroup cols
wbWorkbook$ungroup_cols(sheet = current_sheet(), cols)sheetsheet
cols= cols
The wbWorkbook object
remove_col_widths()Remove row heights from a worksheet
wbWorkbook$remove_col_widths(sheet = current_sheet(), cols)sheetA name or index of a worksheet
colsIndices of columns to remove custom width (if any) from.
The wbWorkbook object, invisibly
set_col_widths()Group cols
wbWorkbook$set_col_widths(
sheet = current_sheet(),
cols,
widths = 8.43,
hidden = FALSE
)sheetsheet
colscols
widthsWidth of columns
hiddenA logical vector to determine which cols are hidden; values
are repeated across length of cols
The wbWorkbook object, invisibly
group_rows()Group rows
wbWorkbook$group_rows(
sheet = current_sheet(),
rows,
collapsed = FALSE,
levels = NULL
)sheetsheet
rowsrows
collapsedcollapsed
levelslevels
The wbWorkbook object, invisibly
ungroup_rows()ungroup rows
wbWorkbook$ungroup_rows(sheet = current_sheet(), rows)sheetsheet
rowsrows
The wbWorkbook object
remove_worksheet()Remove a worksheet
wbWorkbook$remove_worksheet(sheet = current_sheet())sheetThe worksheet to delete
The wbWorkbook object, invisibly
add_data_validation()Adds data validation
wbWorkbook$add_data_validation(
sheet = current_sheet(),
dims = "A1",
type,
operator,
value,
allow_blank = TRUE,
show_input_msg = TRUE,
show_error_msg = TRUE,
error_style = NULL,
error_title = NULL,
error = NULL,
prompt_title = NULL,
prompt = NULL,
...
)sheetsheet
dimscell dimension
typetype
operatoroperator
valuevalue
allow_blankallowBlank
show_input_msgshowInputMsg
show_error_msgshowErrorMsg
error_styleThe icon shown and the options how to deal with such inputs. Default "stop" (cancel), else "information" (prompt popup) or "warning" (prompt accept or change input)
error_titleThe error title
errorThe error text
prompt_titleThe prompt title
promptThe prompt text
...additional arguments
The wbWorkbook object
merge_cells()Set cell merging for a sheet
wbWorkbook$merge_cells(sheet = current_sheet(), dims = NULL, ...)sheetsheet
dimsworksheet cells
...additional arguments
The wbWorkbook object, invisibly
unmerge_cells()Removes cell merging for a sheet
wbWorkbook$unmerge_cells(sheet = current_sheet(), dims = NULL, ...)sheetsheet
dimsworksheet cells
...additional arguments
The wbWorkbook object, invisibly
freeze_pane()Set freeze panes for a sheet
wbWorkbook$freeze_pane(
sheet = current_sheet(),
first_active_row = NULL,
first_active_col = NULL,
first_row = FALSE,
first_col = FALSE,
...
)sheetsheet
first_active_rowfirst_active_row
first_active_colfirst_active_col
first_rowfirst_row
first_colfirst_col
...additional arguments
The wbWorkbook object, invisibly
add_comment()Add comment
wbWorkbook$add_comment(sheet = current_sheet(), dims = "A1", comment, ...)sheetsheet
dimsrow and column as spreadsheet dimension, e.g. "A1"
commenta comment to apply to the worksheet
...additional arguments
The wbWorkbook object
remove_comment()Remove comment
wbWorkbook$remove_comment(sheet = current_sheet(), dims = "A1", ...)sheetsheet
dimsrow and column as spreadsheet dimension, e.g. "A1"
...additional arguments
The wbWorkbook object
add_thread()add threaded comment to worksheet
wbWorkbook$add_thread(
sheet = current_sheet(),
dims = "A1",
comment = NULL,
person_id,
reply = FALSE,
resolve = FALSE
)sheeta worksheet
dimsa cell
commentthe comment to add
person_idthe person Id this should be added for
replylogical if the comment is a reply
resolvelogical if the comment should be marked as resolved
add_conditional_formatting()Add conditional formatting
wbWorkbook$add_conditional_formatting(
sheet = current_sheet(),
dims = NULL,
rule = NULL,
style = NULL,
type = c("expression", "colorScale", "dataBar", "iconSet", "duplicatedValues",
"uniqueValues", "containsErrors", "notContainsErrors", "containsBlanks",
"notContainsBlanks", "containsText", "notContainsText", "beginsWith", "endsWith",
"between", "topN", "bottomN"),
params = list(showValue = TRUE, gradient = TRUE, border = TRUE, percent = FALSE, rank =
5L),
...
)sheetsheet
dimsdims
rulerule
stylestyle
typetype
paramsAdditional parameters
...additional arguments
The wbWorkbook object
add_image()Insert an image into a sheet
wbWorkbook$add_image(
sheet = current_sheet(),
dims = "A1",
file,
width = 6,
height = 3,
row_offset = 0,
col_offset = 0,
units = "in",
dpi = 300,
...
)sheetsheet
dimsdims
filefile
widthwidth
heightheight
row_offset, col_offsetoffsets
unitsunits
dpidpi
...additional arguments
The wbWorkbook object, invisibly
add_plot()Add plot. A wrapper for add_image()
wbWorkbook$add_plot(
sheet = current_sheet(),
dims = "A1",
width = 6,
height = 4,
row_offset = 0,
col_offset = 0,
file_type = "png",
units = "in",
dpi = 300,
...
)sheetsheet
dimsdims
widthwidth
heightheight
row_offset, col_offsetoffsets
file_typefileType
unitsunits
dpidpi
...additional arguments
The wbWorkbook object
add_drawing()Add xml drawing
wbWorkbook$add_drawing(
sheet = current_sheet(),
dims = "A1",
xml,
col_offset = 0,
row_offset = 0,
...
)sheetsheet
dimsdims
xmlxml
col_offset, row_offsetoffsets for column and row
...additional arguments
The wbWorkbook object
add_chart_xml()Add xml drawing
Add xml chart
wbWorkbook$add_chart_xml(
sheet = current_sheet(),
dims = NULL,
xml,
col_offset = 0,
row_offset = 0,
...
)sheetsheet
dimsdims
xmlxml
col_offset, row_offsetpositioning parameters
...additional arguments
The wbWorkbook object
add_mschart()Add mschart chart to the workbook
wbWorkbook$add_mschart(
sheet = current_sheet(),
dims = NULL,
graph,
col_offset = 0,
row_offset = 0,
...
)sheetthe sheet on which the graph will appear
dimsthe dimensions where the sheet will appear
graphmschart graph
col_offset, row_offsetoffsets for column and row
...additional arguments
The wbWorkbook object
add_form_control()add form control to workbook
wbWorkbook$add_form_control(
sheet = current_sheet(),
dims = "A1",
type = NULL,
text = NULL,
link = NULL,
range = NULL,
checked = FALSE
)sheetsheet
dimsdims
typetype
texttext
linklink
rangerange
checkedchecked
The wbWorkbook object, invisibly
The wbWorkbook object, invisibly; called for its side-effects
protect()Protect a workbook
wbWorkbook$protect(
protect = TRUE,
password = NULL,
lock_structure = FALSE,
lock_windows = FALSE,
type = 1,
file_sharing = FALSE,
username = unname(Sys.info()["user"]),
read_only_recommended = FALSE,
...
)protectprotect
passwordpassword
lock_structurelock_structure
lock_windowslock_windows
typetype
file_sharingfile_sharing
usernameusername
read_only_recommendedread_only_recommended
...additional arguments
The wbWorkbook object, invisibly
protect_worksheet()protect worksheet
wbWorkbook$protect_worksheet(
sheet = current_sheet(),
protect = TRUE,
password = NULL,
properties = NULL
)sheetsheet
protectprotect
passwordpassword
propertiesA character vector of properties to lock. Can be one
or more of the following: "selectLockedCells",
"selectUnlockedCells", "formatCells", "formatColumns",
"formatRows", "insertColumns", "insertRows",
"insertHyperlinks", "deleteColumns", "deleteRows", "sort",
"autoFilter", "pivotTables", "objects", "scenarios"
The wbWorkbook object
set_creators()Set creator(s)
wbWorkbook$set_creators(creators)creatorsA character vector of creators to set. Duplicates are ignored.
add_creators()Add creator(s)
wbWorkbook$add_creators(creators)creatorsA character vector of creators to add. Duplicates are ignored.
remove_creators()Remove creator(s)
wbWorkbook$remove_creators(creators)create_border
## ------------------------------------------------
## Method `wbWorkbook$add_border`
## ------------------------------------------------
wb <- wb_workbook()
wb$add_worksheet("S1")$add_data("S1", mtcars)
wb$add_border(1, dims = "A1:K1",
left_border = NULL, right_border = NULL,
top_border = NULL, bottom_border = "double")
wb$add_border(1, dims = "A5",
left_border = "dotted", right_border = "dotted",
top_border = "hair", bottom_border = "thick")
wb$add_border(1, dims = "C2:C5")
wb$add_border(1, dims = "G2:H3")
wb$add_border(1, dims = "G12:H13",
left_color = wb_color(hex = "FF9400D3"), right_color = wb_color(hex = "FF4B0082"),
top_color = wb_color(hex = "FF0000FF"), bottom_color = wb_color(hex = "FF00FF00"))
wb$add_border(1, dims = "A20:C23")
wb$add_border(1, dims = "B12:D14",
left_color = wb_color(hex = "FFFFFF00"), right_color = wb_color(hex = "FFFF7F00"),
bottom_color = wb_color(hex = "FFFF0000"))
wb$add_border(1, dims = "D28:E28")
# if (interactive()) wb$open()
wb <- wb_workbook()
wb$add_worksheet("S1")$add_data("S1", mtcars)
wb$add_border(1, dims = "A2:K33", inner_vgrid = "thin", inner_vcolor = c(rgb="FF808080"))
## ------------------------------------------------
## Method `wbWorkbook$add_fill`
## ------------------------------------------------
# example from the gradient fill manual page
gradient_fill <- "
"
## ------------------------------------------------
## Method `wbWorkbook$add_font`
## ------------------------------------------------
wb <- wb_workbook()$add_worksheet("S1")$add_data("S1", mtcars)
wb$add_font("S1", "A1:K1", name = "Arial", color = wb_color(theme = "4"))
## ------------------------------------------------
## Method `wbWorkbook$add_numfmt`
## ------------------------------------------------
wb <- wb_workbook()$add_worksheet("S1")$add_data("S1", mtcars)
wb$add_numfmt("S1", "A1:A33", numfmt = 1)
## ------------------------------------------------
## Method `wbWorkbook$add_cell_style`
## ------------------------------------------------
wb <- wb_workbook()$add_worksheet("S1")$add_data("S1", mtcars)
wb$add_cell_style("S1", "A1:K1",
textRotation = "45",
horizontal = "center",
vertical = "center",
wrapText = "1")
Run the code above in your browser using DataLab