using upload class
using upload class
I have used papa parse to read a csv file. However, I have a file that I need to parse manually because it is not in a csv format.
I see that papa parse 'hijacks' the ajax call to do its work, but I am not understanding how to get to the content of the file. I am looking at the object in the console, but not able to find/reference the actual data
var uploadEditor = new $.fn.dataTable.Editor({
fields: [{
label: 'CSV file:',
name: 'csv',
type: 'upload',
ajax: function (files) {
// Ajax override of the upload so we can handle the file locally. Here we use Papa
// to parse the CSV.
console.log(files[0]);
}
}]
});
$("#importFile").on("click", function () {
uploadEditor.create({
title: 'Language Line Import'
});
});
This question has an accepted answers - jump to answer
Answers
looking at the file, it is actually a spreadsheet with multiple sheets and I need data from the 3rd sheet. The issue is I don't want to have the file uploaded to the server to be parsed.
but I'm guessing I am going to need some special library that can work better with Excel documents??
ahh, I think I found the perfect library to use:
https://www.c-sharpcorner.com/article/reading-a-excel-file-using-html5-jquery/
Nice, thanks for posting,
Colin