Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading records from Excel spreadsheet using ASP.NET? 1

Status
Not open for further replies.

qajussi

Programmer
Mar 22, 2004
236
0
0
US
Hi,

I have one excel spreadsheet with 10 columns.
The users will select which columns they want to read.
Then I want to display those records in the DataGrid.
1)How do I call columns without using the actual header name??
You know know I can call the worksheet like [Sheet1$] in my SQL statemetn like this, "select * from [Sheet1$]"

How do I call columns?? Say I want to select columns 2,3,7 and 8. "Select 2,3...From [Sheet1$]"

2)How can I skip first two rows? Third row has the header information??
When I do "select * from [Sheet1$]", I get F2, F4 and some text which is on the fist two rows as the header in DataGrid.
I am using the DataSet and link it to DataTable.

So I need to skip first two rows and use the third row as the header for the DataGrid??

What can you help??
Thanks much.

 
1) I think you can just reference the column names e.g.
Code:
Select [Column Name] from [Sheet1$]

2) There's a few methods you could use. You could either use named ranges in the excel file, remove rows from the DataTable once you've got the data or even use the ItemDataBound event of the DataGrid to remove the first two rows.




____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top