【问题标题】:Is there a way to write text with emoji to Excel or Google Sheets?有没有办法将带有表情符号的文本写入 Excel 或 Google 表格?
【发布时间】:2020-02-09 21:41:23
【问题描述】:

有没有办法将带有表情符号的文本写入 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")

【问题讨论】:

    标签: r excel google-sheets file-io


    【解决方案1】:

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

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

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

    【讨论】:

    • 感谢您解释 csv/Excel。
    猜你喜欢
    • 1970-01-01
    • 2020-03-15
    • 2021-11-09
    • 1970-01-01
    • 2019-11-27
    • 2020-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多