• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Raaja Gotluru
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 49
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic