OleDb connection to Excel; how do I select fixed width, unbounded height?

前端 未结 5 700
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-13 09:14

I\'m using OleDb to select data from excel spreadsheets. Each spreadsheet can contain many small tables, and possibly furniture like titles and labels. So it might look like

5条回答
  •  死守一世寂寞
    2021-01-13 10:06

    I would go with the solution from John ( reading 1000 rows at a time ).

    If you have Excel installed you could also use OLE automation.

    I have recorded a simple macro in Excel which select the last cell in the current table.

    
    Sub Macro2()
        Range("B14").Select
        Selection.End(xlDown).Select
        //MsgBox ActiveCell.Address, vbOKOnly
    End Sub
    
    

    Now you just need to translate this in C# and read the address of the active cell.

提交回复
热议问题