poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Beardsley <markbrd...@tiscali.co.uk>
Subject Re: Reading spreadsheet
Date Sat, 07 Jul 2012 06:39:41 GMT
If you know the number of the row that holds the column headings, all you
need to do is something like this;

1. Open the workbook.
2. Get a sheet.
3. Read the row containing the column headings.
4. Iterate through the cells on that row searching for a specific value.
5. Once you find that value, make a note of the cells column index or
number.
6. Get the remaining rows on the sheet one by one.
7. Get the cell whose index matches the cell index of the header cell found
in step number 5 above.
8. Get the value from that cell.

The code you need to perform each of these steps is explained in the various
parts of either the Quick Guide
(http://poi.apache.org/spreadsheet/quick-guide.html) or FAQ
(http://poi.apache.org/faq.html) sections of the webs site. For exaple,
reading a workbook is outlined here -
http://poi.apache.org/spreadsheet/quick-guide.html#ReadWriteWorkbook -
iterating over rows and cells here -
http://poi.apache.org/spreadsheet/quick-guide.html#Iterator - and getting at
a cells contents, here -
http://poi.apache.org/spreadsheet/quick-guide.html#CellContents

Yours

Mark B

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Reading-spreadsheet-tp5710399p5710400.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message