r - Googlesheets4 不读取我的电子表格
问题描述
我正在使用 googlesheets4 来存储 Shiny 数据。我可以访问我的 googleDrive,但我无法阅读任何表格。我也试过“sheet_examples”,但我得到了同样的错误信息,见下文。这是一段给出错误的代码:
我试过了:
drive_auth(email="MyEmail@gmail.com")
sheets_auth(token = drive_token())
(DRIVE = drive_get("MySpeadSheet"))
SPE = read_sheet(DRIVE, range = "MySheet")
我尝试了不同的方法来获取带有“read_sheet”(包括 sheet_examples)的工作表,但每次我收到以下错误:
Error in parse(df$cell, ctype, ...) : is_string(ctype) is not TRUE
解决方案
以下代码对我有用:
my_data = read_sheet(ss, sheet = "city-popul", range = "C2:C50", col_types="c")
它指定列是字符。
请参阅此处的规格: https ://googlesheets4.tidyverse.org/reference/read_sheet.html
对于多个列,您需要指定每个列类型;请参阅规范中的示例。
推荐阅读
- python - 如何将外键ID传递给表单?或将表单链接到外键值 DJango
- php - 如果在 foreach 中不为空,则将变量包含到数组中
- java - 如何构建openCSV CSVReader
- python - 如何从python中的变量中删除某些单词和数字
- reactjs - React Saleor 产品类别
- postgresql - PostgreSQL - 我应该只为其他还没有索引的列创建索引吗?
- amazon-web-services - 上传大约 100 个小文件,S3 事件通知丢失
- python - 如何正确屏蔽卷积神经网络中的值
- python - Python Pip 无法使用 pip 命令识别任何模块
- javascript - 如何将更多权重分配给更高的指数