使用 POI 读取一系列 Excel 表格数据 [英] Reading a range of excel sheet data using POI

查看:23
本文介绍了使用 POI 读取一系列 Excel 表格数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一些 POC,以单次读取从 Excel 文件到 Java 数组的范围内的数据.

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

我必须使用 Java 中的 POI 读取 excel 文件,其中行数将接近 1,00,000,列数将接近 240.我从互联网上获得的大多数示例都讲述了使用 rowIterator 和 cellIterator 来完成这项工作.但是由于行数和列数很大,遍历每个单元格并添加数据到数组中并不是一个可行的解决方案.

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.

POI API 中是否有任何方法可以一次性获取一系列单元格并将其传输到 java 中的数组?

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?

我仍在浏览 POI API,但直到现在还没有成功找到解决方案.如果有人知道这样的方法,你能用一个小的工作例子来说明吗?

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?

推荐答案

CellWalk 可能会有所帮助.见 http://poi.apache.org/apidocs/org/apache/poi/ss/util/cellwalk/CellWalk.html

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

您可以在此处找到示例使用:http://svn.apache.org/repos/asf/poi/trunk/src/testcases/org/apache/poi/ss/util/cellwalk/TestCellWalk.java

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

这篇关于使用 POI 读取一系列 Excel 表格数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆