I have some jquery files I am using to customize Django admin. I want to draw in a code table from a local csv file using Google's jquery-csv.
function getCodeTable() {
$.ajax({
url: "admin/js/custom/Sample100.csv",
aync: false,
success: function (csv) {
csv_as_objects = $.csv.toObjects(csv);
},
dataType: "text",
complete: function () {
return csv_as_objects;
}
});
}
The original csv file is created by Postgres. When I put it in my project and try to access it, I get this error:
CSVDataError: Illegal quote [Row:3]
Thinking that there is something wrong with the csv, I have opened it in Notepad++ to look for problems, but I see none.
I have run the file through https://csvlint.io/ and it came out valid. I then downloaded their Standardized CSV of the same file. When I opened it and looked at it, the only changes it made where to put quotes around the primary keys. I put that in my project and ran, and came back with the same error:
CSVDataError: Illegal quote [Row:3]
I thought Postgres is giving me some badly formatted csv file somehow, so I went to this site https://www.appsloveworld.com/sample-csv-file/ and downloaded a csv file named Sample100.csv
to see how that works.
Comes back with the same error:
CSVDataError: Illegal quote [Row:3]
So now it seems any csv file I put in comes back with the same error. I do not know if this is a jquery-csv
library problem (doubt it), or if I am missing something in my code
First 5 lines of codeTable.csv:
"codecategoryid","codecategorydesc","codetypeid","codetypedesc"
15,"Address Types",60,"Mailing Address"
15,"Address Types",59,"Physical Address"
15,"Address Types",61,"PO Box"
8,"Agricultural Employee Types",22,"Distribution Worker"
First 5 lines of Standardized CSV of my codeTable.csv downloaded from https://csvlint.io/:
"codecategoryid","codecategorydesc","codetypeid","codetypedesc"
"15","Address Types","60","Mailing Address"
"15","Address Types","59","Physical Address"
"15","Address Types","61","PO Box"
"8","Agricultural Employee Types","22","Distribution Worker"
First 5 lines of Sample100.csv downloaded from https://www.appsloveworld.com/sample-csv-file/:
Serial Number,Company Name,Employee Markme,Description,Leave
9788189999599,TALES OF SHIVA,Mark,mark,0
9780099578079,1Q84 THE COMPLETE TRILOGY,HARUKI MURAKAMI,Mark,0
9780198082897,MY KUMAN,Mark,Mark,0
9780007880331,THE GOD OF SMAAL THINGS,ARUNDHATI ROY,4TH HARPER COLLINS,2