excelDoc: Get objects representing parts of an Excel xlsx file

View source: R/classes.R

excelDocR Documentation

Get objects representing parts of an Excel xlsx file

Description

These functions create objects representing different elements of an Excel file. excelDoc refers to the top-level xslx file. workbook returns the identifier for the workbook. getSheet yields a Worksheet object which has both the XML contentand the identifier for the corresponding file within the xlsx archive.

Usage

excelDoc(f, create = FALSE,
         template = system.file("templateDocs", "Empty.xlsx",
                                  package = "RExcelXML"),
          class = "ExcelArchive")
getSheet(doc, which, asXML = TRUE) 

Arguments

f

the name of the xlsx file

create

a logical value that is used if the specified file f does not exist. If this is TRUE, we copy a template xlsx file to the new file name. Otherwise, we generate an error.

template

the name of a file to copy if we are creating a new spreadsheet.

class

the class of the object to be returned. This allows the caller to create an object of a derived/sub-class

doc

the workbook archive

which

a number or a string identifying the sheet within the workbook/xlsx file

asXML

a logical value. If this is TRUE, getSheet returns a Worksheet which contains the parsed XML document for the sheet. If this FALSE, getSheet returns a WorksheetFile-class which just identifies the file for the sheet within the xlsx file without parsing/reading it.

Author(s)

Duncan Temple Lang

Examples

  f = system.file("SampleDocs", "Workbook1.xlsx", package = "RExcelXML")
  e = excelDoc(f)
  names(e)

  w = workbook(e)
  names(w)
  w[[1]]


  f = system.file("SampleDocs", "pics.xlsx", package = "RExcelXML")
  e = excelDoc(f)
  getImages(e)


  f = system.file("SampleDocs", "Images.xlsx", package = "ROOXML")
  e = excelDoc(f)
  getImages(e)

duncantl/RExcelXML documentation built on Nov. 23, 2023, 4:21 p.m.