Reading a range of excel sheet data using POI

耗尽温柔 提交于 2019-12-11 00:52:55

问题


I am doing some POC on reading data within a range from an excel file to an array in Java in singleshot.

I have to read an excel file using POI in Java where the no: of rows will be near to 1,00,000 and the no: of columns will be near to 240. Most of the examples which I got from internet tells about using rowIterator and cellIterator for getting this job done. But since the rowcount and columncount is huge, iterating through each cell and adding data to an array is not a feasible solution.

Is there any method in POI API which will fetch a range of cells in one shot and transfer it to an array in java?

I am still going through the POI API, but was not successful in finding a solution till now. If someone knows about such a method, can you illustrate it with a small working example?


回答1:


CellWalk might help. see http://poi.apache.org/apidocs/org/apache/poi/ss/util/cellwalk/CellWalk.html

You can find a sample use here: http://svn.apache.org/repos/asf/poi/trunk/src/testcases/org/apache/poi/ss/util/cellwalk/TestCellWalk.java



来源:https://stackoverflow.com/questions/11858941/reading-a-range-of-excel-sheet-data-using-poi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!