Workbook: Functions to manipulate Excel 2007 workbooks.

Description Usage Arguments Details Value Author(s) See Also Examples

Description

createWorkbook creates an empty workbook object.

Usage

1
2
3
4
5
createWorkbook(type = "xlsx")

loadWorkbook(file, password = NULL)

saveWorkbook(wb, file, password = NULL)

Arguments

type

a String, either xlsx for Excel 2007 OOXML format, or xls for Excel 95 binary format.

file

the path to the file you intend to read or write. Can be an xls or xlsx format.

password

a String with the password.

wb

a workbook object as returned by createWorkbook or loadWorkbook.

Details

loadWorkbook loads a workbook from a file.

saveWorkbook saves an existing workook to an Excel 2007 file.

Reading or writing of password protected workbooks is supported for Excel 2007 OOXML format only. Note that in Linux, LibreOffice is not able to read password protected spreadsheets.

Value

createWorkbook returns a java object reference pointing to an empty workbook object.

loadWorkbook creates a java object reference corresponding to the file to load.

Author(s)

Adrian Dragulescu

See Also

write.xlsx for writing a data.frame to an xlsx file. read.xlsx for reading the content of a xlsx worksheet into a data.frame. To extract worksheets and manipulate them, see Worksheet.

Examples

1
2
3
4
5
6
7
8
9
wb <- createWorkbook()

# see all the available java methods that you can call
rJava::.jmethods(wb)

# for example
wb$getNumberOfSheets()   # no sheet yet!

# loadWorkbook("C:/Temp/myFile.xls")

xlsx documentation built on Nov. 10, 2020, 3:52 p.m.