Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selective quoting causes Excel to treat .csv as UTF-16 (.txt) on next save #759

Closed
dholstius opened this issue Dec 6, 2017 · 2 comments
Closed
Labels
feature a feature request or enhancement

Comments

@dholstius
Copy link

I'm using readr::write_csv to dump a comma-delimited file out for my Excel-using friend. A couple of cells have commas in the cell value, so those are escaped with double quotes. So far so good.

My friend opens the file and hits Ctrl-S, without making any edits.

Oddly, what Excel writes out is now delimited by tabs, not commas.

Digging a little deeper, I try the same thing myself, but "Save As" instead of Ctrl-S ... and see that Excel is suggesting "UTF-16 Unicode Text (.txt)" in the "Save As" dialog. WTF?

  • csvclean (from csvkit) reports no errors in the file on disk.
  • I'm on a Mac, so the line endings are not CRLF. But I can convert them to CRLF (using unix2dos) and the same thing happens.
  • The problem is avoided by using base::write.csv with quote = TRUE.

Can we have a quote = option in write_csv? Maybe the default should be FALSE. But why not allow it?

I like the efficiency of selective quoting but we have to share the world with Excellers.

Thanks!

@jimhester
Copy link
Collaborator

#653 also suggests a quote option.

@dholstius
Copy link
Author

Thanks @jimhester, +1 for #653 then.

Should it default to TRUE in write_excel_csv, even if it defaults to FALSE in write_csv?

@jimhester jimhester added the feature a feature request or enhancement label Dec 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants