locked
Reading Data from Excel RRS feed

  • General discussion

  • Hello,
    How can I read date from Excel to DataSet?

    I don't know, how many columns and rows ExcelSheet has.
    I don't know datatype of columns.
    I 'am sure, that first column in XLS sheet is empty, hasn't name and hasn't defined datatype.

    Thank's
    OndrejD
    Monday, February 23, 2009 4:45 PM

All replies

  • See if the following helps:

    How To Use ADO.NET to Retrieve and Modify Records in an Excel Workbook With Visual Basic .NET


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Monday, February 23, 2009 5:22 PM
  • You could use Jet or ACE OLEDB provider with IMEX=1 connection string option to force treat all the values in spreadsheet as strings, regardless which data type cell values have. Then you would need to do manipulation in a client code to convert strings (if you need) into actual data type. Keep in mind that Excel does not have "column" type and each cell has its own, so Jet or ACE providers have limitations in this area.
    If that is not working for you, you could try .NET managed reader for Excel from my web site that allows reading values from Excel using their native data type.


    Val Mazur (MVP) http://www.xporttools.net
    Wednesday, February 25, 2009 11:25 AM