How to create an Excel File with Nodejs?

前端 未结 10 910
攒了一身酷
攒了一身酷 2020-11-30 17:17

I am a nodejs programmer . Now I have a table of data that I want to save in Excel File format . How do I go about doing this ?

I found a few Node libraries . But m

10条回答
  •  误落风尘
    2020-11-30 17:40

    XLSx in the new Office is just a zipped collection of XML and other files. So you could generate that and zip it accordingly.

    Bonus: you can create a very nice template with styles and so on:

    1. Create a template in 'your favorite spreadsheet program'
    2. Save it as ODS or XLSx
    3. Unzip the contents
    4. Use it as base and fill content.xml (or xl/worksheets/sheet1.xml) with your data
    5. Zip it all before serving

    However I found ODS (openoffice) much more approachable (excel can still open it), here is what I found in content.xml

    
        
            here be a1
        
        
            here is b1
        
        
    
    

提交回复
热议问题