Learn R Programming

openxlsx2 (version 1.4)

wb_copy_cells: Copy cells around within a worksheet

Description

Copy cells around within a worksheet

Usage

wb_copy_cells(
  wb,
  sheet = current_sheet(),
  dims = "A1",
  data,
  as_value = FALSE,
  as_ref = FALSE,
  transpose = FALSE,
  ...
)

Value

the wbWorkbook invisibly

Arguments

wb

A workbook

sheet

a worksheet

dims

A cell where to place the copy

data

A wb_data object containing cells to copy

as_value

Should a copy of the value be written?

as_ref

Should references to the cell be written?

transpose

Should the data be written transposed?

...

additional arguments passed to add_data() if used with as_value

See Also

wb_data()

Other workbook wrappers: base_font-wb, col_widths-wb, creators-wb, grouping-wb, row_heights-wb, wb_add_chartsheet(), wb_add_data(), wb_add_data_table(), wb_add_formula(), wb_add_pivot_table(), wb_add_slicer(), wb_add_worksheet(), wb_base_colors, wb_clone_worksheet(), wb_freeze_pane(), wb_merge_cells(), wb_save(), wb_set_last_modified_by(), wb_workbook()

Examples

Run this code
wb <- wb_workbook()$
add_worksheet()$
  add_data(x = mtcars)$
  add_fill(dims = "A1:F1", color = wb_color("yellow"))

dat <- wb_data(wb, dims = "A1:D4", col_names = FALSE)
# 1:1 copy to M2
wb$
  clone_worksheet(old = 1, new = "Clone1")$
  copy_cells(data = dat, dims = "M2")

Run the code above in your browser using DataLab