0

I'm new here. If I'm doing something wrong just tell me. Thanks ;)

My Problem: I need to open an excel file from the client. The user has to choose a file in a form in HTML or JS and then JS needs to open this file and parse it. This fiddle is a good example:

http://jsfiddle.net/3ve90afo/

HTML:

<input id="readfile" type="file" onchange="loadFile(event)"/>
<xmp id="output"></xmp>

JS:

print('AlaSQL v'+alasql.version)
print('Please upload txt, json, csv, tsv, tab, xlsx, xls or html file to see the content')

loadFile = function(event) {
    alasql('SELECT * FROM FILE(?,{headers:true})',[event],function(data){
        print(data)
    });
}

function print(x){
    document.getElementById('output').textContent += JSON.stringify(x,  null, '\t')+"\n";
}

So, alaSQL seemed good and easy for this problem. But the above code always comes to this error:

Uncaught TypeError: path must be a string or Buffer
    at Object.fs.readFile (fs.js:274:11) ....

I didn't find any answer to this error in the web. So, is there another possibility to do this or a way to fix this error?

StevoG26
  • 1
  • 2

0 Answers0