write_sheet() error: Don't know how to make an instance of `CellData` from something of class 'data.frame'
write_sheet() error: Don't know how to make an instance of `CellData` from something of class 'data.frame'
我从我们的 mongoDB
查询了这个
data2 <- table$find(
query = '{"disabled" : true}',
fields = '{"general.name" : true, "_id": true')
View(data)
看起来和我预期的一样,但是当我尝试使用 googlesheets4::write_sheet(data = data2, ss = "a google url", sheet = "a name")
它给出了这条消息:
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'.
创建 xls 或 csv 可以正常工作,但 gsheet 不行。 mongoDB 以外的其他来源的数据帧可以写入 gsheet。
没有样本数据很难回答。
但是,我遇到了这个错误,问题是数据框包含一个带有嵌套数据的列。使用 tidyr,我发现 unnest()
展平列将允许写入 sheet。
https://tidyr.tidyverse.org/reference/nest.html#grouped-data-frames
我从我们的 mongoDB
查询了这个data2 <- table$find(
query = '{"disabled" : true}',
fields = '{"general.name" : true, "_id": true')
View(data)
看起来和我预期的一样,但是当我尝试使用 googlesheets4::write_sheet(data = data2, ss = "a google url", sheet = "a name")
它给出了这条消息:
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'.
创建 xls 或 csv 可以正常工作,但 gsheet 不行。 mongoDB 以外的其他来源的数据帧可以写入 gsheet。
没有样本数据很难回答。
但是,我遇到了这个错误,问题是数据框包含一个带有嵌套数据的列。使用 tidyr,我发现 unnest()
展平列将允许写入 sheet。
https://tidyr.tidyverse.org/reference/nest.html#grouped-data-frames