3

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="MyEmail@gmail.com")
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
zx8754
  • 52,746
  • 12
  • 114
  • 209
Maxime
  • 51
  • 4
  • Is your issue related to this one on Github (related to character encoding)? https://github.com/tidyverse/googlesheets4/issues/59. Otherwise, I'd consider posting there, since it's getting active development now. – ravic_ Nov 22 '19 at 17:22
  • There's more guidance here, including looking at the `gargle` version, and potentially using the dev version: https://github.com/tidyverse/googlesheets4/issues/26 – ravic_ Nov 22 '19 at 18:02
  • Thanks! I found interesting info there but it did not solve my issue. Does it work for you? – Maxime Nov 25 '19 at 09:29

1 Answers1

0

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.

Timothée HENRY
  • 14,294
  • 21
  • 96
  • 136