-
Notifications
You must be signed in to change notification settings - Fork 656
XLS
Mathias Rangel Wulff edited this page Mar 14, 2017
·
10 revisions
AlaSQL can export data in Excel 2003 format (.xls) with coloring of cells.
Please know that we recommend exporting to ".xlsx" instead of ".xls" as Microsoft has started refusing to open files in the old format.
var opts = {
headers: true,
sheetid: 'My Birds',
style:"background:#00ff00",
columns: [
{columnid:'a',title:'Albatroses',
style:'background:red;font-size:20px',
cell:{style:'background:blue'}
},
{columnid:'b',title:'Bird',cell:{
style:function(value,sheet,row,column,rowidx,columnidx){
return 'background'+(value==10?'brown':'white')
}}},
{
columnid: 'b', cell:{value:function(value){ return value * value}}
}
]
};
var res = alasql('SELECT * INTO XLS("restest257a",?) FROM ?',[opts,data]);
Please, see the example with advanced color syntax in jsFiddle.
You can pass the object as a Blob:
alasql('SELECT * FROM XLS(?,{headers:true}',[myblob]);
To read .xls
files, please include the xlsx
lib from https://cdnjs.com/libraries/xlsx
If you need Excel 2007 files please check out XLSX
© 2014-2024, Andrey Gershun & Mathias Rangel Wulff
Please help improve the documentation by opening a PR on the wiki repo