deleteDataColumn: Deletes a whole column from a workbook

View source: R/wrappers.R

deleteDataColumnR Documentation

Deletes a whole column from a workbook

Description

Deletes the whole column from a workbook, shifting the remaining columns to the left

Usage

deleteDataColumn(wb, sheet, col)

Arguments

wb

A workbook object

sheet

A name or index of a worksheet

col

A column to delete

Author(s)

David Zimmermann

Examples

## write some data
wb <- createWorkbook()
addWorksheet(wb, "tester")

for (i in seq(5)) {
  mat <- data.frame(x = rep(paste0(int2col(i), i), 10))
  writeData(wb, sheet = 1, startRow = 1, startCol = i, mat)
  writeFormula(wb, sheet = 1, startRow = 12, startCol = i,
               x = sprintf("=COUNTA(%s2:%s11)", int2col(i), int2col(i)))
}
deleteDataColumn(wb, 1, col = 3)
## Not run: 
saveWorkbook(wb, "deleteDataColumnExample.xlsx", overwrite = TRUE)

## End(Not run)

openxlsx documentation built on Sept. 20, 2024, 5:08 p.m.