3

我正在使用 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
4

1 回答 1

0

以下代码对我有用:

my_data = read_sheet(ss, sheet = "city-popul", range = "C2:C50", col_types="c")

它指定列是字符。

请参阅此处的规格: https ://googlesheets4.tidyverse.org/reference/read_sheet.html

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

于 2020-09-15T06:05:05.280 回答