Last chance! 50% off unlimited learning
Sale ends in
Last chance! 50% off unlimited learning
Sale ends in
Having obtained a GoogleWorsheetRef, one can query its number of rows and columns
directly (i.e. without an additional query to the Google server)
and one can coerce the contents to data frame or matrix with
as(sheetRef, "data.frame")
.
getWorksheets(doc, con = getGoogleDocsConnection(service = "wise"), stringsAsFactors = default.stringsAsFactors())
sheetAsMatrix(sheet, header = FALSE, as.data.frame = TRUE, trim = TRUE, con = sheet@connection, doc = xmlParse(getCells(sheet, con = con)), stringsAsFactors = default.stringsAsFactors())
GoogleDocument
object
obtained via a call to getDocs
.
In sheetAsMatrix
this is the parsed XML document containing
the cell values. This is typically computed via the
default value of the parameter. But one can call getCells
separately with non-default values for the parameters.
"GoogleSpreadsheetsConnection"
created with a call of the form getGoogleDocsConnection(login, password, "wise")
.GoogleWorksheetRef
.TRUE
indicating whether the first row of the worksheet is to be treated
as the header, and c) a logical value of FALSE
indicating that there are no column headers available
and so use V1, V2, ...
FALSE
) or a data frame (TRUE
)
is to be createdNA
s.TRUE
), or leave as character
vectors (FALSE
).GoogleWorksheetRef
objects.
Each of these is an object of class GoogleWorksheetRef-class
.The names of the sheets are used as the names of the returned R list object.
getGoogleDocsConnection
getDocs
if(exists("GoogleDocsPassword")) {
# getGoogleDocsConnection("my login", "my password", "wise")
con = getGoogleDocsConnection(names(GoogleDocsPassword), GoogleDocsPassword, "wise")
sheets = getWorksheets("TwoSheets", sheets.con)
docs = getDocs(sheets.con)
sheets = getWorksheets(docs[["TwoSheets"]], sheets.con)
names(sheets)
}
Run the code above in your browser using DataLab