使用POI技术实现excel文件的导入

1.POI概念

Apache POI 是用Java编写的免费开源的跨平台的Java API,Apache POI提供API给Java程序对Microsoft Office格式档案读和写的功能,其中使用最多的就是使用POI操作Excel文件。POI为"Poor Obfuscation Implementation"的首字母缩写,意为"简洁版的模糊实现"。

官网地址:

https://poi.apache.org/componen

2.POI坐标依赖

复制代码
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>4.1.2</version>
</dependency>

3.POI核心API概述

3.1 创建工作簿对象

复制代码
Workbook workbook=new XSSFWorkbook(path)

3.2 获取execl表中的sheet对象

复制代码
Sheet sheet = workbook.getSheetAt(0);

3.3 获取excel文件中所有物理数据的有效行数

复制代码
int rows = sheet.getPhysicalNumberOfRows()

3.4获取行对象

复制代码
Row row =sheet.getRow(i)

3.5 获取行中的列对象

复制代码
Cell cell=row.getCell(0)

3.6 获取列的字符串类型数据

复制代码
cell.getStringCellValue()

3.7 获取列的数字类型字段数据

复制代码
cell.getNumericCellValue()
相关推荐
wtsolutions1 小时前
Real-World Use Cases - How Organizations Use Excel to JSON
json·github·excel
一只小H呀の2 小时前
pandas处理excel数据
excel·pandas
wregjru2 小时前
【操作系统】3.开发工具
excel
wtsolutions4 小时前
MCP Service Integration - Excel to JSON for AI and Automation
人工智能·json·excel
wtsolutions15 小时前
JSON to Excel Add-in - Seamless Integration Within Excel
json·excel
wtsolutions15 小时前
Getting Started with JSON to Excel Web App - Convert in Seconds
json·excel·web app
wtsolutions19 小时前
Using the JSON to Excel API - Programmatic Access for Developers
json·excel
qq_4351395719 小时前
EasyExcel(FastExcel)Excel导出功能 技术文档
excel
wtsolutions1 天前
Understanding JSON Formats - What JSON to Excel Supports
json·excel
wtsolutions1 天前
Advanced Features - Unlocking the Power of JSON to Excel Pro
linux·json·excel