commit inicial
This commit is contained in:
commit
44aa6d0132
1271
index.html
Normal file
1271
index.html
Normal file
File diff suppressed because it is too large
Load Diff
36
index.json
Normal file
36
index.json
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
var oFileIn;
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
oFileIn = document.getElementById('my_file_input');
|
||||||
|
if(oFileIn.addEventListener) {
|
||||||
|
oFileIn.addEventListener('change', filePicked, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function filePicked(oEvent) {
|
||||||
|
// Get The File From The Input
|
||||||
|
var oFile = oEvent.target.files[0];
|
||||||
|
var sFilename = oFile.name;
|
||||||
|
// Create A File Reader HTML5
|
||||||
|
var reader = new FileReader();
|
||||||
|
|
||||||
|
// Ready The Event For When A File Gets Selected
|
||||||
|
reader.onload = function(e) {
|
||||||
|
var data = e.target.result;
|
||||||
|
var cfb = XLS.CFB.read(data, {type: 'binary'});
|
||||||
|
var wb = XLS.parse_xlscfb(cfb);
|
||||||
|
// Loop Over Each Sheet
|
||||||
|
wb.SheetNames.forEach(function(sheetName) {
|
||||||
|
// Obtain The Current Row As CSV
|
||||||
|
var sCSV = XLS.utils.make_csv(wb.Sheets[sheetName]);
|
||||||
|
var oJS = XLS.utils.sheet_to_row_object_array(wb.Sheets[sheetName]);
|
||||||
|
|
||||||
|
$("#my_file_output").html(sCSV);
|
||||||
|
console.log(oJS)
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Tell JS To Start Reading The File.. You could delay this if desired
|
||||||
|
reader.readAsBinaryString(oFile);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user