Maxime
Maxime

Reputation: 51

Googlesheets4 does not read my Spreadsheets

I am using googlesheets4 to store Shiny data. I could reach my googleDrive but I am not able to read any sheet. I also tried "sheet_examples" but I got the same error message, see below. Here is a piece of code that gives the error:

I tried:

drive_auth(email="[email protected]")
sheets_auth(token = drive_token())
(DRIVE = drive_get("MySpeadSheet"))
SPE = read_sheet(DRIVE,  range = "MySheet")

I have tried different ways to get my sheet with "read_sheet" (including sheets_examples) but every time I get the following error:

Error in parse(df$cell, ctype, ...) : is_string(ctype) is not TRUE

Upvotes: 3

Views: 1385

Answers (1)

Timothée HENRY
Timothée HENRY

Reputation: 14604

The following code worked for me:

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

It specifies the column is character.

See the specs here: https://googlesheets4.tidyverse.org/reference/read_sheet.html

For several column you will need to specify each column type; see the examples in the specs.

Upvotes: 0

Related Questions