Spire.DataExport for .NET is a 100% pure data .NET component suit for exporting data into MS Word, Excel, RTF, Access, PDF, XPS, HTML, XML, Text, CSV, DBF, SYLK, SQL Script, DIF, Clipboard, etc.

Thu Oct 16, 2008 9:34 pm

I can't read sheets exported by Spire.DataExport with Jet's OLEDB provider unless I first open & save the file with Excel.

When I first asked this question, I thought the problem was that multiple tabs were selected when the file was saved. Opening the file, selecting one tab and then closing the file solved the problem. However, it was opening & saving the file that solved the problem, no the selection of only one tab.

My code to read the XLS file:

Code: Select all
Dim conn As New OleDbConnection
Dim cmd As New OleDbCommand
Dim dap As OleDbDataAdapter
Dim dt As SampleDataTable

conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""C:\sample.xls"";Extended Properties=""Excel 8.0;"""

cmd.CommandText = "SELECT * FROM [Sample$]"
cmd.Connection = conn
dap = New OleDbDataAdapter(cmd)

With conn
   dt = new SampleDataTable
End With

More info about reading Excel files in VB.NET using OLEDB can be found here: http://www.codeproject.com/KB/office/excel_using_oledb.aspx

Posts: 1
Joined: Thu Oct 16, 2008 9:23 pm

Thu Nov 06, 2008 7:45 am


If you want to read/write excel file without OLE, please try to using Spire.XLS.
For more detailed information,

Posts: 35
Joined: Thu Jun 29, 2006 2:29 pm

Return to Spire.DataExport