当前位置:网站首页>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;
}
边栏推荐
- Special tutorial - Captain selection game
- Bit.Store:熊市漫漫,稳定Staking产品或成主旋律
- Go从入门到实战—— 多路选择和超时控制(笔记)
- Go从入门到实战——共享内存并发机制(笔记)
- "Apprendre cette image" apparaît sur le Bureau win11 comment supprimer
- TypeScript学习
- Can Oracle's CTAs bring constraints and other attributes to the new table?
- 熊市慢慢,Bit.Store提供稳定Staking产品助你穿越牛熊
- Tiktok's interest in e-commerce has hit the traffic ceiling?
- Acwing周赛57-数字操作-(思维+分解质因数)
猜你喜欢

Codeforces Round #717 (Div. 2)

GFS分布式文件系统

Go from entry to practice - multiple selection and timeout control (notes)

How to participate in openharmony code contribution

数据平台调度升级改造 | 从Azkaban 平滑过度到Apache DolphinScheduler 的操作实践

DO280OpenShift访问控制--security policy和章节实验

ICML2022 | 可扩展深度高斯马尔可夫随机场

Focus! Tips for installing fonts on domestic computers

Use the storcli tool to configure raid. Just collect this article

空指针异常
随机推荐
TypeScript学习
集合代码练习
TreeSet details
释放开源数据库创新力量 | 【甘肃】openGauss Meetup圆满结束
100 important knowledge points that SQL must master: using functions to process data
How to delete "know this picture" on win11 desktop
强制 20 天内开发 APP 后集体被裁,技术负责人怒批:祝“早日倒闭!”
富文本 考试 填空题
oracle迁移mysql唯一索引大小写不区分别怕
数据平台调度升级改造 | 从Azkaban 平滑过度到Apache DolphinScheduler 的操作实践
华为伙伴暨开发者大会2022开源时刻全纪录
于文文、胡夏等明星带你玩转派对 皮皮APP点燃你的夏日
Wechat applet based service management system for college party members' Home System applet graduation design, Party members, activists, learning, punch in, forum
SQL必需掌握的100个重要知识点:创建计算字段
Codeforces Global Round 14
熊市慢慢,Bit.Store提供稳定Staking产品助你穿越牛熊
跟我一起AQS SOS AQS
Codeforces Round #723 (Div. 2)
Use the storcli tool to configure raid. Just collect this article
如何将队列里面的内容没秒钟执行一次优先级