当前位置:网站首页>Easyexcel read file
Easyexcel read file
2022-06-26 01:47:00 【NewBee. Mu】
public XSSFSheet bulkLoad(MultipartFile file) {
try {
InputStream inputStream = new ByteArrayInputStream(file.getBytes());
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
// Determine whether it is a template document
XSSFRow row1 = sheet.getRow(0);
XSSFCell cell = row1.getCell(0);
cell.setCellType(CellType.STRING);
String stringCellValue = cell.getStringCellValue();
int physicalNumberOfCells = row1.getPhysicalNumberOfCells();
if (!" ID number ".equals(stringCellValue) || physicalNumberOfCells != 10){
return null;
}
return sheet;
} catch (IOException | StringIndexOutOfBoundsException e) {
return null;
}
}
This method performs template verification , Verify whether the first row and the first column are ID number , Is there a total of 10 A title , If not , There is a problem with the template
public void bulkLoadContent(XSSFSheet sheet) {
Integer rows = sheet.getPhysicalNumberOfRows();
XSSFRow row;
PatientInformation patientInformation = new PatientInformation();
RegisterInformation registerInformation = new RegisterInformation();
BasicInformationImportLog importLog = new BasicInformationImportLog();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
boolean flag;
for (int i = 1; i < rows; i++) {
flag = true;
StringBuffer buffer = new StringBuffer();
// For the first i Row data
row = sheet.getRow(i);
if (row == null) {
continue;
}
// The value of the first column
String value= StringTrim(row.getCell(0).getStringCellValue());
.
.
.
.
.
.
}
}
Here you can traverse to get excel The values in the table and deal with them
边栏推荐
- 2021 - 1 - 15 notes de pêche Ctrl + C / V
- ActivityManager kill reason
- 弹性蛋白酶的用途和化学性质
- 论文阅读 Exploring Temporal Information for Dynamic Network Embedding
- 2021-1-15 摸魚做的筆記Ctrl+c /v來的
- Dataframe converts the data type of a column
- 王老吉药业“关爱烈日下最可爱的人”公益活动在杭启动
- Oracle数据库完全卸载步骤(暂无截图)
- NLP enhanced technology
- PTA class a simulated third bomb: 1140-1143
猜你喜欢
随机推荐
tos cos dscp 区别和作用
PTA class a simulated ninth bullet: 1114-1117
PTA class a simulated 11th bomb: 1124-1131
Summary of xlnet model
PTA class a simulated 8th bomb: 1164-1167
GUN make (3) Makefile的规则
User unlock status query
What is the process of opening a mobile card account? Is it safe to open an account online?
web测试
Abnova丨抗GBA单克隆抗体解决方案
Shell regular expression
JSON basic syntax
Abnova丨CMV CISH 探头解决方案
Oracle常用的基础命令
俏皮少女王艺璇 受邀担任第六季完美童模全球总决赛推广大使
Embedded c learning notes
Oracle数据库完全卸载步骤(暂无截图)
JQ user defined attribute value
easyexcel读取文件
Data analysis - similarities and differences between C-end and b-end data analysis