473,320 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Importing from excel

OleDbConnection excel1 = new OleDbConnection();

excel1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\Documents and Settings\\Jed\\My Documents\\pro cd\
\testsheet.xls;Extended Properties=Excel 8.0;";
OleDbDataAdapter fillds = new OleDbDataAdapter("SELECT
Barcode,Part_Count,Cycle_Time FROM [Sheet1$]", excel1);

System.Data.DataTable ds = new
System.Data.DataTable();
fillds.Fill(ds);

This is the code i am using but i am getting this error when i execute
the fill statement.

External table is not in the expected format.

What am i doing wrong here?Please help. thanks in advance
Jun 27 '08 #1
2 1214
The error is meaningful .. there is some issue with the data in the Sheet.
Check that the data type is unique for every column.

HTH

"Cdude" <ca*******@yahoo.comwrote in message
news:60**********************************@y21g2000 hsf.googlegroups.com...
OleDbConnection excel1 = new OleDbConnection();

excel1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\Documents and Settings\\Jed\\My Documents\\pro cd\
\testsheet.xls;Extended Properties=Excel 8.0;";
OleDbDataAdapter fillds = new OleDbDataAdapter("SELECT
Barcode,Part_Count,Cycle_Time FROM [Sheet1$]", excel1);

System.Data.DataTable ds = new
System.Data.DataTable();
fillds.Fill(ds);

This is the code i am using but i am getting this error when i execute
the fill statement.

External table is not in the expected format.

What am i doing wrong here?Please help. thanks in advance
Jun 27 '08 #2
On May 12, 7:51*am, Cdude <camelj...@yahoo.comwrote:
*OleDbConnection excel1 = new OleDbConnection();

excel1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\Documents and Settings\\Jed\\My Documents\\pro cd\
\testsheet.xls;Extended Properties=Excel 8.0;";
* * * * * * * * OleDbDataAdapter fillds = new OleDbDataAdapter("SELECT
Barcode,Part_Count,Cycle_Time FROM [Sheet1$]", excel1);

* * * * * * * * System.Data.DataTable ds = new
System.Data.DataTable();
* * * * * * * * fillds.Fill(ds);

This is the code i am using but i am getting this error when i execute
the fill statement.

External table is not in the expected format.

What am i doing wrong here?Please help. thanks in advance
Hi,
I have posted in the past code to read from excel in the way you want,
do a search in the archives by "ignacio machin" excel code and you
should find it
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Little PussyCat | last post by:
Hello, I nee to write something that will transfer excel data into an SQL Server table. I have for another database application I wrote have it importing Excel spreadsheet data using cell by...
9
by: Edward S | last post by:
I budget for a Project in an Excel sheet as illustrated below. The months below are usually a 2 year period i.e. 24 months, though it could be over 24 months depending upon a Project. I then...
7
by: Darren | last post by:
I have been attempting to create a reservation planning form in excel that imports Data from an Access database and inserts that information automaticly into the correct spreed sheet and the...
2
by: nutthatch | last post by:
I want to be able to import an Excel spreadsheet into Access 2K using the macro command Transferspreadsheet. However, the file I am importing (over which I have no control) contains some records...
9
by: jillandgordon | last post by:
I am trying to import an excel file into Access 97. It looks perfectly all right but, every time I try to import it, I get to the lst step and am told that it was not imported due to an error. ...
2
by: Snozz | last post by:
The short of it: If you needed to import a CSV file of a certain structure on a regular basis(say 32 csv files, each to one a table in 32 databases), what would be your first instinct on how to...
2
by: jereviscious | last post by:
Hi all - Last resort time. I'm importing data from a spreadsheet that I receive from one of my vendor using interop.excel. The date field in excel is entered as 4/7/2006, but when I retrieve...
5
by: hharriel | last post by:
Hi, I am hoping someone can help me with an issue I am having with excel and ms access. I have collected data (which are in individual excel files) from 49 different school districts. All...
3
by: mukeshsrivastav | last post by:
dear sir i want to move form excel to access. i have 5 excel file having same formats and fields.now i want to import all data in one access table. importing one file is easy .but importing and...
28
by: kkadakia | last post by:
I get a daily excel file for a entire month which I want to transfer into Access at the end of the month. So, there are around 20-25 excel files I get by the end of the month, and I would like to...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.