uploadDoc | R Documentation |
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.
uploadDoc(content, con, name, type = as.character(findType(content)),
binary = FALSE, asText = FALSE, folder = NULL, replace = TRUE, ...)
deleteDoc(doc, con = getConnection(auth), auth = getGoogleAuth(), ...)
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 |
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.
The caller can pass the value as an "AsIs" object, i.e.
|
binary |
a logical value indicating whether the content being uploaded is binary or not. |
asText |
a logical indicating whether the value of |
... |
additional arguments to be passed to the |
auth |
the auth token returned from a call to |
folder |
the identifier for a Google Folder. This should be a
|
replace |
a logical value. If this is |
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.
Duncan Temple Lang
getGoogleDocsConnection
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)
# uploading to a folder
# Specify the folder object
docs = getDocs(con)
uploadDoc(x, con, name = "boo", type = "csv", folder = docs$MyFolder)
f = docs$MyFolder
f[["boo1", type = 'csv']] = x
# We'll have to lookup the folder id in the call.
uploadDoc(x, con, name = "boo2", type = "csv", folder = "MyFolder")
# Give the explicit URL directly
uploadDoc(x, con, name = "boo3", type = "csv", folder = I(docs$MyFolder@content["src"]))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.