wood burning stoves 2.0*
The moose likes Java in General and the fly likes How to get column index number based on cell value of a excel sheet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to get column index number based on cell value of a excel sheet" Watch "How to get column index number based on cell value of a excel sheet" New topic
Author

How to get column index number based on cell value of a excel sheet

Raaja Gotluru
Ranch Hand

Joined: Mar 02, 2010
Posts: 108
Hi,

I am having an different excel sheets with first row as the header. In that one column header is "email".

I want to know the email address in that column basing on the column index while iterating through rows. I dont want the rest of the column values.

How to acieve this guide me.

Thanks.

--raaja. g
Jon Avadis
Ranch Hand

Joined: Jul 20, 2011
Posts: 49

To handle Excel files, the easiest way is to use an API like JXL (->google).

Then you can iterate through the cells of the first row until you get the cell-content "email" (the header of the column your looking for).
Now you know what column number your email adresses are stored in and you can iterate through the cells of that column and read
out all the email-adresses.

You could do it without an external library if you convert the Excelfile to a CSV first, and then read the file with a Scanner or whatever you
prefer.


Knowledge Reigns Supreme
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get column index number based on cell value of a excel sheet
 
Similar Threads
how to create jtable with rowheader as well as with columnheader
Column Click
iReport freeze pane
How to make datatable header bold?
Selecting entire column