I queried this from our mongoDB
data2 <- table$find(
query = '{"disabled" : true}',
fields = '{"general.name" : true, "_id": true')
View(data)
looks as I would expect it but when I try to use the googlesheets4::write_sheet(data = data2, ss = "a google url", sheet = "a name")
it gives out this message:
Writing to "gsheetname"
Writing to sheet "a name"
Error: Don't know how to make an instance of `CellData` from something of class 'data.frame'.
creating an xls or csv works fine but gsheet doesn't. Data frames from other sources than mongoDB, can be written into a gsheet.
It is hard to answer without sample data.
However, I have encountered this error and the problem is that the data frame contains a column with nested data. Using the tidyr, I have found unnest()
to flatten the columns will allow the sheet to be written.
https://tidyr.tidyverse.org/reference/nest.html#grouped-data-frames