asafdav / ng-csv

Simple directive that turns arrays and objects into downloadable CSV files
MIT License
573 stars 215 forks source link

Disable quote escaping #158

Open ksx-kshan opened 8 years ago

ksx-kshan commented 8 years ago

I would like to suggest, or if you would accept a pull-request, the ability to disable the quote escaping via a directive attribute

escape-quotes="false" maybe

I want to be able to output ="123456789" so excel will read this as a formula and not display it in scientific notation

Perhaps there is a less brute force way to go about making something display not as a number, but simply disbling quote escaping would suffice.

dturrina commented 8 years ago

I agree with @ksx-kshan I have a similar issue when trying to force a numeric string to be effectively a string - because of leading zeroes - instead of a number.

ghost commented 7 years ago

Actually if you need this feature right now and (as me) don't have time to wait until the author accept my pull request... you just have to do these steps:

1.- Open file build/ng-csv.js 2.- Comment the line number 68. It should look like this: // data = data.replace(/"/g, '""'); // Escape double qoutes 3.- Enjoy =D BTW: I needed my accout field to look like this inside the CSV, in order to display correctly without exponential values in Excel: "=""xxxxxxxxxxxxxxxxxxxx""" where xxx... is the number