Skip to content

Commit

Permalink
Fixed potential bugs with commas and quotation marks in csv
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewzpu committed Apr 24, 2024
1 parent 6b660e4 commit ce5a513
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,14 @@
var csvrow = [];
for (var j = 0; j < cols.length; j++) {
if (typeof sortedRows[0][selectedProperties[j]] != "object") {
csvrow.push(cols[j].innerHTML);
var data = "\"" + cols[j].innerHTML + "\"";
for (var k = 1; k < data.length - 1; k++) {
if (data.charAt(k) == "\"") {
data = data.slice(0,k) + "\"" + data.slice(k);
k++;
}
}
csvrow.push(data);
}
}
Expand Down

0 comments on commit ce5a513

Please sign in to comment.