Worksheet-class: Representation of an Excel Worksheet

Worksheet-classR Documentation

Representation of an Excel Worksheet

Description

This class is used to represent and individual worksheet within an Excel workbook/file. This corresponds to an individual data grid within the Excel interface.

Objects from the Class

Objects of this class are typically created indirectly and obtained as the return values from calls to getSheet and [[,Workbook,ANY,missing-method.

Slots

content:

Object of class "XMLInternalDocument" the parsed XML document that provides the content of the worksheet.

name:

Object of class "ZipArchiveEntry" the identifier for the top-level xlsx archive and the entry within that corresponds to the worksheet. This allows us to resolve material that is part of the worksheet, but contained elsewhere in the xlsx archive, e.g. shared strings.

Methods

[

signature(x = "Worksheet", i = "missing", j = "missing"): access subsets of cells in the worksheet

[

signature(x = "Worksheet", i = "integer", j = "character"): access subsets of cells in the worksheet

[<-

signature(x = "Worksheet", i = "numeric", j = "numeric"): assign values to one or more cells in the worksheet

[<-

signature(x = "Worksheet", i = "numeric", j = "character"): ...

[[<-

signature(x = "Workbook", i = "ANY", j = "ANY", value = "Worksheet"): ...

dim

signature(x = "Worksheet"): compute the number of rows and columns within the worksheet

docName

signature(doc = "Worksheet"): the name of the underlying XML document.

names

signature(x = "Worksheet"): names of the columns

Author(s)

Duncan Temple Lang

See Also

excelDoc, workbook.

Examples

  f = system.file("SampleDocs", "Workbook1.xlsx", package = "RExcelXML")
  e = excelDoc(f)
  w = workbook(e)
  w[[1]]
  names(w)

  sh = w[[1]]
  as(sh, "data.frame")

  sh[1, "C"]

  sh[1:2,]



  sh = workbook( excelDoc( f ) )[[1]]
  sh[1:2, compact = TRUE]

  sh[1:2, "D", compact = TRUE]

  sh[c(2, 4), ]


## Not run: 
  e = excelDoc("mine1.xlsx", create  = TRUE)
  sh = workbook(e)[[1]]
  sh[1,1] = 10
  sh[2,1] = 20
  sh[4,1, asFormula = TRUE] = "SUM(A1:A2)"
  sh[1, "D", asFormula = TRUE] = "SUM(A1:A2)"

## End(Not run)

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