Faster way to read an Excel sheet

  • Thread starter Thread starter Joe
  • Start date Start date
J

Joe

Hi All!

I'm using OleDbDataAdapter right now but it takes a very long time to read
in the sheet. Is there any way to improve upon the performance?

Thanks,
Joe
 
That depends. You can use COM Interop to open the file and manipulate it but
in my experience, it's relatively slow as well compared to similar
operations done in VBA and excel. It really depends on what you are doing
though -
 
I need to load the workbook into DataTables - one DataTable for each sheet.
Right now each sheet gets a separate query. I wonder if I can get all sheets
at one time.
 
Hi Joe,

This depends on if the driver supports returning multiple resultsets. If it
is SQL server, we can use "SELECT * FROM Table1; SELECT * FROM Table2;", so
that two DataTables will be created in a DataSet.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Joe;

Using COM interop you can definitely do it. Essentially you take over the
whole workbook so you can add whatever you want however you want and format
however you want. Not sure if it's the fastest way to do it, but it's
definitely doable and pretty simple.
 
¤ Joe;
¤
¤ Using COM interop you can definitely do it. Essentially you take over the
¤ whole workbook so you can add whatever you want however you want and format
¤ however you want. Not sure if it's the fastest way to do it, but it's
¤ definitely doable and pretty simple.

Yeah, but it's much slower than data access as you previously pointed out. Especially if you're
working with DataTables.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
You're welcome.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top