【问题标题】:Download spedific tab of google sheet in R在 R 中下载 google sheet 的特定标签
【发布时间】:2020-08-07 17:45:59
【问题描述】:

我正在尝试将特定选项卡从 google sheet 下载到 R,在尝试 gsheet 包后,无论我如何更改 sheetid,我都只能获得第一个选项卡。

我还尝试使用库 googlesheets4 来识别工作表 ID,但结果为空,我做错了什么?还有其他方法可以完成这个简单的任务吗?谢谢!

url <- 'https://docs.google.com/spreadsheets/d/1c2QrNMz8pIbYEKzMJL7Uh2dtThOJa2j1sSMwiDo5Gz4/htmlview?pru=AAABc95C0MI*0Y0sH44yYwVlu_QuDo_X3g#'
 ridoc <- gsheet2tbl(url)
 ridoc2 <- gsheet2tbl(url,sheetid = 2)

sheets_auth()
theSheets <- sheets_find()
theSheets

【问题讨论】:

    标签: r google-sheets googlesheets4


    【解决方案1】:

    你不能使用 googlesheets4 中的函数 read_sheet() 吗?

    df <- read_sheet(url, sheetname)
    

    其中 sheetname 是您要读取的工作表的名称(以字符串形式)。

    如果您想阅读所有表格:

    sheets_names <- sheet_names(url)
    list_1 <- lapply(sheets_names, function (x) read_sheet(url, x))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-06-14
      • 1970-01-01
      • 1970-01-01
      • 2010-10-21
      • 2021-02-05
      • 2015-07-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多