uploadDoc {RGoogleDocs}R Documentation

Add or remove a document

Description

These functions allow the caller to manipulate the collection of documents in the Google Docs account. One can upload a document from the local machine. And one can remove or delete a document from the remote repository.

Usage

uploadDoc(content, con, name, type = as.character(findType(content)), 
           binary = FALSE, asText = FALSE, ...)
deleteDoc(doc, con = getConnection(auth), auth)

Arguments

content the name of a local file or the actual content of a document to be uploaded.
doc the name of the Google document to be removed.
con the CURL connection to the Google Docs API which has been authenticated. See getGoogleDocsConnection.
name the name of the new document to be created (or the document to be replaced).
type the type of document. This can be the MIME type (e.g. "text/csv") or the short hand, e.g. "csv", "odt", ..., capitalized or uncapitalized. The type is matched in the vector DocTypeExtensions.
binary a logical value indicating whether the content being uploaded is binary or not.
asText a logical indicating whether the value of content is to be treated as the content to be uploaded (TRUE) or the name of a file (FALSE).
... additional arguments to be passed to the curlPerform call.
auth the auth token returned from a call to getGoogleAuth and used to initialize a connection.

Value

uploadDoc returns an object of class GoogleDocument describing the newly uploaded document.
deleteDoc returns 0 if the operation succeeded or a CURL error if it failed.

Author(s)

Duncan Temple Lang

See Also

getGoogleDocsConnection

Examples


if(exists("GoogleDocsPassword")) {
          # getGoogleDocsConnection("my login", "my password")

  con = getGoogleDocsConnection(names(GoogleDocsPassword), GoogleDocsPassword)

  x = "1, 2, 3\n4, 5, 6\n"
  uploadDoc(x, con, name = "direct csv", type = "csv")

  deleteDoc("Untitled Presentation", con)
}

[Package RGoogleDocs version 0.2-1 Index]