有没有办法将带有表情符号的文本写入 Excel 或 Google 表格?

Is there a way to write text with emoji to Excel or Google Sheets?

有没有办法将带有表情符号的文本写入 Excel 或 Google 表格?我有一个这样的数据框,我已经尝试 write.csv()fileEncoding 参数集,但没有成功。

df <- data.frame(number = c(1, 2),
                textEmoji = c("Test ",
                              "Test "))

write.csv(df, file="df.csv", row.names = FALSE, fileEncoding = "UTF-8")

您可以将其写入 .xlsx 文件:

rio::export(df, "test.xlsx")

我刚刚检查过,您使用 write.csv() 的方法也有效。问题只是 Excel 显然无法识别 "UTF-8"(当读回 R 时它有效)。虽然编码保存在 .xlsx 中,因此 Excel 将正确显示该编码。