Solved

c#  Reading WorkSheets from Excel File

Posted on 2008-06-21
2
391 Views
Last Modified: 2013-12-16
Hi,
I have an Excel file with 3 work sheets namely (Order of Tabs is)  1)ZR  2)JIMP 3) STON
When I read them the Order is not accordingly .. The array is populated like  list(0) = STON
                                                                                                                         list(1) = JIMP
                                                                                                                         list(2) = ZR
I dont want it like this.. It should be in the order of the Tabs  in the Exel Sheet.
Here is the code
dataTable tables = connection.GetSchema("Tables");
                          List<string> list = new List<string>();
                       foreach (DataRow row in tables.Rows)
                            list.Add(row["TABLE_NAME"].ToString());
                      return list;
0
Comment
Question by:dotnet0824
2 Comments
 
LVL 18

Expert Comment

by:vbturbo
ID: 21841067
Try paste the code on how you access and read the excell file

vbturbo
0
 
LVL 1

Accepted Solution

by:
WendellUrth earned 250 total points
ID: 22058893
Hi there,

Why not just reverse the order in your list?

list.Reverse();

That should do it.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question