当前位置:网站首页>Method of reading file contents by Excel
Method of reading file contents by Excel
2022-06-27 21:44:00 【sorghum】
/** * describe : obtain IO Data in the stream , Assemble into List<List<Object>> object * @param in,fileName * @return * @throws IOException */
public List<List<Object>> getBankListByExcel(InputStream in, String fileName) throws Exception
{
List<List<Object>> list = null;
// establish Excel Workbooks
Workbook work = this.getWorkbook(in, fileName);
if (null == work)
{
throw new Exception(" establish Excel The workbook is empty !");
}
Sheet sheet = null;
Row row = null;
Cell cell = null;
list = new ArrayList<List<Object>>();
// Traverse Excel All of the sheet
for (int i = 0; i < work.getNumberOfSheets(); i++)
{
sheet = work.getSheetAt(i);
if (sheet == null)
{
continue;
}
// Traverse the current sheet All rows in
for (int j = sheet.getFirstRowNum(); j <= sheet.getLastRowNum(); j++)
{
row = sheet.getRow(j);
if (row == null || row.getFirstCellNum() == j)
{
continue;
}
// Traverse all columns
List<Object> li = new ArrayList<Object>();
for (int y = row.getFirstCellNum(); y < row.getLastCellNum(); y++)
{
cell = row.getCell(y);
li.add(this.getCellValue(cell));
}
list.add(li);
}
}
((InputStream) work).close();
return list;
}
边栏推荐
- Goldfish rhca memoirs: do447 managing projects and carrying out operations -- creating job templates and starting jobs
- SQL必需掌握的100个重要知识点:IN 操作符
- 100 important knowledge points that SQL must master: retrieving data
- OpenSSL 编程 二:搭建 CA
- Galaxy Kirin system LAN file sharing tutorial
- Use the storcli tool to configure raid. Just collect this article
- 图解基于AQS队列实现的CountDownLatch和CyclicBarrier
- JVM memory structure when creating objects
- Go from introduction to actual combat -- channel closing and broadcasting (notes)
- Go from introduction to actual combat - package (notes)
猜你喜欢

强制 20 天内开发 APP 后集体被裁,技术负责人怒批:祝“早日倒闭!”

Very comprehensive dolphin scheduler installation and use documents

What is the core competitiveness of front-line R & D personnel aged 35~40 in this position?

Release of global Unicorn list in 2021: the full list of 301 Unicorn enterprises in China is coming!

华为伙伴暨开发者大会2022开源时刻全纪录

"Apprendre cette image" apparaît sur le Bureau win11 comment supprimer

Codeforces Round #719 (Div. 3)

Can Oracle's CTAs bring constraints and other attributes to the new table?

于文文、胡夏等明星带你玩转派对 皮皮APP点燃你的夏日

AI painting minimalist tutorial
随机推荐
本周二晚19:00战码先锋第8期直播丨如何多方位参与OpenHarmony开源贡献
Go from introduction to actual combat - context and task cancellation (notes)
于文文、胡夏等明星带你玩转派对 皮皮APP点燃你的夏日
小王的面试训练任务
ICML2022 | 可扩展深度高斯马尔可夫随机场
Go从入门到实战——package(笔记)
快递e栈——数组篇小型项目
GBase 8a V8版本节点替换期间通过并发数控制资源使用减少对系统影响的方法
100 important knowledge points for SQL: in operator
Codeforces Global Round 14
SQL必需掌握的100个重要知识点:IN 操作符
gomock mockgen : unknown embedded interface
GFS distributed file system
Common methods of string class
Go from introduction to actual combat - package (notes)
OpenSSL 编程 一:基本概念
Flask----应用案例
Codeforces Round #716 (Div. 2)
excel读取文件内容方法
数组作业题