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”(包括 sheets_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

对于多个列,您需要指定每个列的类型;请参阅规范中的示例。

https://stackoverflow.com/questions/58998384/

相关文章:

node.js - Sequelize findAndCountAll 并计算包含的模型

r - 代码相当于 RStudio 查看器 Pane 中的 'broom' 图标?

git - Devops Azure 没有足够的钩子(Hook)权限(对于协作者)

reactjs - React 中的 forwardingRef 与回调 refs 有什么区别?

react-native - 在 bazel 构建中运行 react-native cli

graphql - gatsby-source-contentful 不适用于 gatsby-tra

arrays - 当我在 PowerShell 中更改数组的值时,我不断收到 "Unable to

python - Jupyter Lab 交互图像展示 : issue with widgets a

powershell - 下载 Powershell 文档

python - 使用 TorchScript 类作为 pytorch 模块中的成员