Skip to content

Instantly share code, notes, and snippets.

@milliethe
Forked from simonjamain/parseCsv.gs
Created October 22, 2020 21:16
Show Gist options
  • Save milliethe/fe68adc82ae6530f40eb8dc14e19c720 to your computer and use it in GitHub Desktop.
Save milliethe/fe68adc82ae6530f40eb8dc14e19c720 to your computer and use it in GitHub Desktop.
fix the bug on Utilities.parseCsv() google script function which does not allow newlines in csv strings
function parseCsv(csvString, delimiter) {
var sanitizedString = csvString.replace(/(["'])(?:(?=(\\?))\2[\s\S])*?\1/g, function(e){return e.replace(/\r?\n|\r/g, ' ') });
return Utilities.parseCsv(sanitizedString, delimiter)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment