## Parsing Workbooks For parsing, the first step is to read the file. This involves acquiring the data and feeding it into the library. Here are a few common scenarios: - node readFile: ```js if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */ ``` - ajax (for a more complete example that works in older browsers, check the demo at ): ```js /* set up XMLHttpRequest */ var url = "test_files/formula_stress_test_ajax.xlsx"; var oReq = new XMLHttpRequest(); oReq.open("GET", url, true); oReq.responseType = "arraybuffer"; oReq.onload = function(e) { var arraybuffer = oReq.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 */ } oReq.send(); ``` - HTML5 drag-and-drop using readAsBinaryString or readAsArrayBuffer: note: readAsBinaryString and readAsArrayBuffer may not be available in every browser. Use dynamic feature tests to determine which method to use. ```js /* processing array buffers, only required for readAsArrayBuffer */ function fixdata(data) { var o = "", l = 0, w = 10240; for(; l