RGoogleDocs (version 0.7-0)

GoogleWorksheetRef-class: Description of a remote Google Worksheet

Description

This class describes a remote Google worksheet object which is a single sheet within a Google spreadsheet. The object has information about the location of the contents of the worksheet and also its dimensions at the time at which the information was computed by R. (It is possible that the worksheet has changed after this time.) We can use this object to get the contents of the worksheet and its dimension, etc.

We can also modify the contents of a worksheet using the common subset assignments in R, e.g. x[1, 1] <- 10, x[1:3, 4:9] <- 10, x[1:3,] <- 10, x[1:3,] <- 10, and x[,] <- 10.

The dim and getExtent functions can be applied to a worksheet. dim returns the number of rows and columns for the entire worksheet, be they empty or not. getExtent returns a 2 x 2 matrix with indicating the effective number of rows and columns. The two columns give the minimum and maximum indices for the rows and columns respectively.

Arguments

Objects from the Class

Objects are created via calls to getWorksheets and addWorksheet and are very rarely

Slots

title
the name/title of the worksheet
dims
the number of rows and columns
url
the URL of the document
listfeed
content feed URL for working with rows.
cellsfeed
content feed URL for working with the individual cells
connection
the connection given as con in the call which is used to be able to return to the list/cells feed to get the contents without the need for a connection.
edit
the content feed URL for editing the document.

Methods

[
signature(x = "GoogleWorksheetRef", i = "numeric", j = "numeric"): syntactic sugar for retrieving subrows and columns of this matrix
dim
signature(x = "GoogleWorksheetRef"): get the dimensions (number of rows and columns) of this worksheet.

See Also

getWorksheets addWorksheet

Examples

Run this code
showClass("GoogleWorksheetRef")

## Not run: 
# docs = getDocs(con)
# 
# book = addSpreadsheet(con, c(21, 12), "dummy")
# sh = addWorksheet(docs$mine4, con, title = "testing")
# 
# sh[,10, extent = 5] = letters[1:3]
# sh[,4, extent = c(2, 5)] = letters[1:3]
# sh[,8, extent = TRUE] = letters[1:3]
# sh[,9, extent = FALSE] = letters[1:3]
# ## End(Not run)

Run the code above in your browser using DataCamp Workspace