How to read an Excel spreadsheet in c# quickly

前端 未结 5 1113
被撕碎了的回忆
被撕碎了的回忆 2020-12-05 06:13

I am using Microsoft.Office.Interop.Excel to read a spreadsheet that is open in memory.

gXlWs = (Microsoft.Office.Interop.Excel.Worksheet)gXlApp.ActiveWorkbo         


        
5条回答
  •  一个人的身影
    2020-12-05 06:39

    I guess it's not the Convert the source of "slowing"...

    Actually, retrieving cell values is very slow.

    I think this conversion is not necessary:

    (Microsoft.Office.Interop.Excel.Range)gXlWs
    

    It should work without that.

    And you can ask directly:

    gXlWs.Cells[NumRow, 1].Value != null
    

    Try to move the entire range or, at least, the entire row to an object Matrix and work with it instead of the range itself.

提交回复
热议问题