Reputation: 7725
Is there a way to write text with emoji to Excel or Google Sheets? I have a dataframe like this, and I've tried write.csv()
with the fileEncoding
parameter set, but no luck.
df <- data.frame(number = c(1, 2),
textEmoji = c("Test 👇",
"Test 😊"))
write.csv(df, file="df.csv", row.names = FALSE, fileEncoding = "UTF-8")
Upvotes: 2
Views: 687
Reputation: 12430
You can write it to a .xlsx
file:
rio::export(df, "test.xlsx")
I just checked and your approach with write.csv()
works as well. The problem is just that Excel doesn't recognize the "UTF-8"
apparently (it works when read back into R
). Encoding is saved though in the .xlsx
so Excel will displays that one properly.
Upvotes: 1