Converting Excel File From .csv To .xlsx

后端 未结 6 1187
清歌不尽
清歌不尽 2020-12-05 18:54

I want my application to go and find a csv excel file and convert it into a .xlsx file instead.

Here\'s what I\'m currently doing;

var fileName = @\"         


        
6条回答
  •  盖世英雄少女心
    2020-12-05 19:19

    I would recommend using the following technique:

    1. http://kbcsv.codeplex.com/ this reads CSV files in very easily and is very robust.
    2. Create a datatable from the csv via the kbcsv extensions.
    3. Use the eppplus library and its LoadFromDataTable to create a valid xlsx file (https://github.com/JanKallman/EPPlus)
    4. done!

    Advantages:

    • It is faster than excel interop
    • KBCSV is more robust than excels csv reading methods.
    • It is availabe in environments witohout office.

提交回复
热议问题