Commit 7ee3266a authored by Sini's avatar Sini
Browse files

xlsx to json conversion with console output

parent b84325cd
Showing with 50 additions and 1 deletion
+50 -1
......@@ -59,6 +59,55 @@ var stuff_paper = []
// }
// // stuff.forEach(addcontent());
// });
//
// begining of xlsx to json coversion
//
/* set up XMLHttpRequest */
var url = "./content/CitationSheet.xlsx";
var xmlHttpRequest = new XMLHttpRequest();
xmlHttpRequest.open("GET", url, true);
xmlHttpRequest.responseType = "arraybuffer";
xmlHttpRequest.onload = function(e) {
var arraybuffer = xmlHttpRequest.response;
/* convert data to binary string */
var data = new Uint8Array(arraybuffer);
var arr = new Array();
for (var i = 0; i != data.length; ++i) arr[i] = String.fromCharCode(data[i]);
var bstr = arr.join("");
/* Call XLSX */
var workbook = XLSX.read(bstr, {
type: "binary"
});
/* DO SOMETHING WITH workbook HERE */
var first_sheet_name = workbook.SheetNames[0];
/* Get worksheet */
var worksheet = workbook.Sheets[first_sheet_name];
var jsonOutput = XLSX.utils.sheet_to_json(worksheet);
console.log(jsonOutput);
// Papa.parse(jsonOutput, {
// download: true,
// header : false,
// complete: function(results) {
// console.log(results.data);
// }
// });
}
xmlHttpRequest.send();
//
// ending of xlsx to json coversion
//
$(document).ready(function(){
$.getJSON("./content/content.json", function(result){
stuff = result;
......@@ -178,4 +227,4 @@ input.addEventListener("keyup", function(event) {
document.getElementById("search-button_paper").click();
}
});
\ No newline at end of file
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment