As far as I am aware - and do bear in mind that I have no experience with SXSSF - it is not possible to read a workbook using SXSSF. This api was created to be used as a tool for writing large files only and that is why I suspect you are not getting the row numbers from the sheet when you ask for them.
If you want to undertake read and then write operations on the same file, the obvious answer is to use the 'normal' usermodel API in the XSSF stream. The problem with that is, as I am sure you are aware, that it imposes quite a large demand upon your systems memory. Having said that, you may have an option. It is possible to use the SAX parser and a custom handler to parse the xml markup with what is known as the event approach - it is detailed here http://poi.apache.org/spreadsheet/how-to.html#xssf_sax_api - and it is quite easy to see that you could use this approach to get at the number of the final row on the sheet. The handler ought to be very simple as you are only interested in the value of the r attribute of the row element (that attribute records the number of the row as a String). Next, you could re-open the workbook using the SXSSF approach and write data into the rows that follow. Both of these are low memory approaches to reading the file on the one hand and writing to it on the other. Off of the top of my head, I cannot see another way around the problem you are facing as I am pretty certain that SXSSF cannot be used to read data from an existing file. If you wanted to make certain of this limitation, it might be worthwhile posting a supplementary question to the list asking just this, something like, 'is it possible to read data from or get information about a sheet in an existing Excel workbook using the SXSSF API?' -- View this message in context: http://apache-poi.1045710.n5.nabble.com/SXSSF-for-Writing-huge-data-on-exisitng-excel-tp5712656p5712670.html Sent from the POI - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
