使用 R 编辑现有 google 文档电子表格

edit existing google docs spreadsheet using R

我听说过并一直在测试 RGoogleDocs R 包,它可以让您登录帐户并查看 google 文档以及上传或删除它们。我可以采取创建新文档然后在销毁旧文档后上传的路线,但我想要一种更优雅的方式。

我使用 rgoogledocs 访问我的电子表格。当需要编辑时,我无法更改任何值。

#this line returns the value in the worksheet in column 1 row 1
myworksheet[[1]][1,1]

#this command does nothing, but I would like to change the value to cow
myworksheet[[1]][1,1] = "cow"

您可以尝试新的 googlesheets 包。将单元格 A1 设置为 "cow":

的示例交互
library(devtools)
install_github('jennybc/googlesheets')
library(googlesheets)

my_sheets <- list_sheets()
myworksheet <- register_ss("worksheetname")
edit_cells(myworksheet, ws = 1, input = "cow", anchor = "A1")