473,385 Members | 1,465 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,385 software developers and data experts.

How convert Excel data into DataSet/DataTable?

Hi,

I need to open an Excel file from within my ASP.NET app and read data. I'm
guessing the most like format in ASP.NET would be a DataTable.

Regardles,, how do I get the data into my ASP.NET app from the Excel file?
I have made a reference to the Excel 11.0 object library, but am not sure
what code comes next.

Thanks,
Ron
Feb 14 '06 #1
2 23006
Ron,
As long as the data in the Sheet is tabular, you would probably be better
off just using an OleDb JET connection string directly to the Excel workbook
and reading in the data with ADO.NET

Excel with Interop is extremely messy on an IIS webserver.

There are a number of samples around, I just don't have one handy.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Ronald S. Cook" wrote:
Hi,

I need to open an Excel file from within my ASP.NET app and read data. I'm
guessing the most like format in ASP.NET would be a DataTable.

Regardles,, how do I get the data into my ASP.NET app from the Excel file?
I have made a reference to the Excel 11.0 object library, but am not sure
what code comes next.

Thanks,
Ron

Feb 14 '06 #2
Hello Ronald,

Use OLE DB Jet provider to access data stored in Excel.
connection string looks like: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=myBook.xls;Extended
Properties="Excel 8.0;HDR=YES";

Then use

OleDbDataAdapter da;
da = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", connectionString);

after that u Fill dataset and use it in your ASP.net page

I recomend to get data in XML format, coz it's easy to trasnsorm them in
suitable form for page using XSLT
RC> I need to open an Excel file from within my ASP.NET app and read
RC> data. I'm guessing the most like format in ASP.NET would be a
RC> DataTable.
RC>
RC> Regardles,, how do I get the data into my ASP.NET app from the Excel
RC> file? I have made a reference to the Excel 11.0 object library, but
RC> am not sure what code comes next.
RC>
RC> Thanks,
RC> Ron
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Feb 14 '06 #3

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

Similar topics

4
by: RK | last post by:
Hi, In my application, I need to copy data from an Excel file into a SQL table. The article related to this can be found at http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B306572 ...
9
by: B. Salmon | last post by:
I have a Visual C++ .NET function that is calling an unmanaged function that returns an ADO _Recordset* object. I want to be able to convert that into an ADO.NET DataSet (or DataTable). I tried...
1
by: Ramakrishnan Nagarajan | last post by:
Hi, I am converting Excel data into a Dataset in C#. There are around 24 columns in the Excel Sheet. First I tried to insert one row with correct values in the Excel sheet. i.e. for text columns...
1
by: ShailShin | last post by:
Hi All, I have to convert Excel data to MSAcess .MDB file using VB.NET. VB.NET Code read the Excel file and write it to .MDB file. For the same I have below code, but I am stuck at the writing it...
2
by: karups | last post by:
Hi when i convert Excel file to dataset using the following code, i find that, some col. such as Col1 ------ 404 403 NOT 222
2
by: ramaraog80 | last post by:
Hi, I want VB Script which converts Excel data into CSV file. Please Reply me ASAP.
3
by: binny | last post by:
i use jet engine ,and oledb database but with this i get four errors which r compile time errores,plz help me to solve these errors i wrote this programe bt it is not working . using System.Web;...
1
by: yogeshbhardwaj | last post by:
I have an excel sheet. its format is like a group eport in access example given below: Soap Sr. no. Qty. Amount 1 15 150 2 ...
4
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post by:
Hi all I have a DataSet with one table filled. From this DataSet (DataTable), I need to create a SqlDataReader. Does anybody knows how to do this ? Is it possible ?? Thanks for any help.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.