Click here to Skip to main content
14,971,029 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,
I am new to this forum, but not very new to c#.
I used to read from excel using regular connection and select statements , but this works with well formatted excel sheets. i am now trying to read from very stupid excel sheet. I cant select a column or all of the range. i need to select ranges such as from A8 to k 17 or to select one cell, A5 . to make it clear, i need to handle with rows not columns.

I am not asking for full code, I just need ideas. such as , use Microsoft.Office.Interop.Excel
or any other C# code,,


1 solution

The basic idea is simple: garbage in, garbage out. :-)

Seriously, a stupid spreadsheet data is still data. If you give up working with it, it's perfectly fine, and the issue is closed. If you want to accept it somehow, you need to understand: there are two source of data: the spreadsheet itself, and the information on how the data is organized and interpreted, which is called meta-data. In your case, the meta-data is the artifact which represents some knowledge used for interpretation of something "stupid" as something which makes sense. If it does not make sense… — see above.

So, this is something I call "junk knowledge". Dealing with it is probably somewhat more challenging. You need to develop some data system representing meta-data used to define layout of data and everything needed to perform the whole workflow of converting it to the data you need. You will need to persist the meta-data in some media (say, XML file; so you can use Data Contract which will do everything related to persistence for you, automatically, see[^]), you can even add some UI for meta-data authoring, so some trained personnel (I mean, not engineers, which is a conception) could express the data layout and processing rules in some graphical and easy-to-understand way. Actually, this problem can be fairly easy because the system of rules can be simple enough.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900