locked
Reading large Excel Files or sheets RRS feed

  • Question

  • User1793720632 posted

    Hi everyone


    I'm tryng to read an excel sheet that has more than 255 cell. I'm using the following code:


    Dim MyConnection As System.Data.OleDb.OleDbConnection
                Dim MyDataSet As New System.Data.DataSet
                Dim connectionString As String = ConfigurationManager.ConnectionStrings("PCOConnectionString2").ConnectionString
                MyConnection = New System.Data.OleDb.OleDbConnection(String.Format("Provider=Microsoft.Jet.OLEDB.4.0;" & _
                "Data Source={0};Extended Properties=""Excel 8.0;HDR" & _
                "=NO""", System.Configuration.ConfigurationManager.AppSettings("rout1")))
                MyConnection.Open()
                Dim MyCommand As String = String.Format("select * from [{0}$]", System.Configuration.ConfigurationManager.AppSettings("Sheet1"))
                Dim MyAdapter As New OleDbDataAdapter(MyCommand, MyConnection)
                MyAdapter.Fill(MyDataSet, "Sheet1")


    this code throws me an error that indicates me that there are too many rows to read. I found, seaching through forums, that it can't be more that 255 cells on the sheet i'm reading.

    How can i read this sheet that has over 500 cells?

    Thanks in advance


    Hernán From Colombia

    Wednesday, February 10, 2010 6:56 AM

Answers

All replies