xl.workbook.add: Basic operations with Excel workbooks

Description Usage Arguments Details Value See Also Examples

View source: R/xl.workbooks.R

Description

Basic operations with Excel workbooks

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
xl.workbook.add(filename = NULL)

xl.workbook.open(filename, password = NULL, write.res.password = NULL)

xl.workbook.activate(xl.workbook.name)

xl.workbooks(full.names = FALSE)

xl.workbook.save(
  filename,
  password = NULL,
  write.res.password = NULL,
  file.format = xl.constants$xlOpenXMLWorkbook
)

xl.workbook.close(xl.workbook.name = NULL)

Arguments

filename

character. Excel workbook filename.

password

character. Password for password-protected workbook.

write.res.password

character. Second password for editing workbook.

xl.workbook.name

character. Excel workbook name.

full.names

logical. Should we return full path to the workbook? FALSE, by default.

file.format

integer. Excel file format. By default it is xl.constants$xlOpenXMLWorkbook. You can use xl.constants$xlOpenXMLWorkbookMacroEnabled for workbooks with macros (*.xlsm) or xl.constants$xlExcel12 for binary workbook (.xlsb).

Details

Value

See Also

xl.sheets, xl.read.file, xl.save.file

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 
## senseless actions
data(iris)
data(cars)
xl.workbook.add()
xlrc[a1] = iris
xl.workbook.save("iris.xlsx")
xl.workbook.add()
xlrc[a1] = cars
xl.workbook.save("cars.xlsx")
xl.workbook.activate("iris")
xl.workbook.close("cars")
xl.workbook.open("cars.xlsx")
xl.workbooks()
for (wb in xl.workbooks()) xl.workbook.close(wb)
unlink("iris.xlsx")
unlink("cars.xlsx")

# password-protected workbook
data(iris) 
xl.workbook.add()
xlrc[a1] = iris
xl.workbook.save("iris.xlsx", password = "my_password")
xl.workbook.close()
xl.workbook.open("iris.xlsx", password = "my_password")
xl.workbook.close()
unlink("iris.xlsx")

## End(Not run)

excel.link documentation built on Nov. 2, 2021, 9:12 a.m.