AlaSQL / alasql

AlaSQL.js - JavaScript SQL database for browser and Node.js. Handles both traditional relational tables and nested JSON data (NoSQL). Export, store, and import data from localStorage, IndexedDB, or Excel.
http://alasql.org
MIT License
7.04k stars 659 forks source link

Not able to get the column names when reading a range from xlsx file #924

Open bhavnarpj opened 7 years ago

bhavnarpj commented 7 years ago

AlaSQL is based on unpaid voluntary work. Thank you for taking the time to make it better.

Programming question?

Something not working as expected?

bhavnarpj commented 7 years ago

Hi, I am new to alasql & am trying to read an xlsx file, but unable to read the columns when I specify the range to be read from file. How do I specify the column names to be read so that I can use those to process data later. I tried the below query but it does not give the desired output.

loadFile = function(event) { alasql('SELECT B as Particulars, C as Debit, D as Credit FROM FILE(?,{range:"A13:D177"})',[event],function(data){ print(data) }); }

I want to process data using data[i]["column name"]. Or is there a better way to show data in tabular format? Does the range work only with xlsx files? How do we handle this in csv files? Trying to read the 1st sheet in attached excel.

Tally_TB_Sample.xlsx

Thanks, Bhavna

mathiasrw commented 7 years ago

Please use http://stackoverflow.com/questions/ask?tags=alasql to ask questions about usage