How to convert html table to excel with multiple sheet?

后端 未结 8 1840
清歌不尽
清歌不尽 2020-11-28 05:53

How can I convert multiple html tables to an excel sheet with multiple worksheets? Could you please help into this.

My example https://jsfiddle.net/kdkd/5p22gdag/

8条回答
  •  误落风尘
    2020-11-28 06:33

    Here is a better solution that supports exporting table in the latest Excel format i.e. xlsx . The accepted solution would fail in case the total number of rows being exported exceeds 3407 on Chrome.

    An example from the link above: http://jsfiddle.net/6ckj281f/

    html

    
    

    javascript

    window.saveFile = function saveFile () {
    var data1 = [{a:1,b:10},{a:2,b:20}];
    var data2 = [{a:100,b:10},{a:200,b:20}];
    var opts = [{sheetid:'One',header:true},{sheetid:'Two',header:false}];
    var res = alasql('SELECT INTO XLSX("restest344b.xlsx",?) FROM ?',
                     [opts,[data1,data2]]);
    }
    

提交回复
热议问题