使用 R 编辑现有的谷歌文档电子表格

Bac*_*gie 2 r google-docs google-docs-api

我听说并一直在使用 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"
Run Code Online (Sandbox Code Playgroud)

Aja*_*jar 5

你可以试试新的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")
Run Code Online (Sandbox Code Playgroud)