Convert excel format exception.You can try specifying the 'excelType' yourself
时间: 2023-08-16 09:39:11 浏览: 187
To convert an Excel file to a different format, you can use a library like Apache POI in Java. If you encounter an exception related to the Excel format, you can try specifying the 'excelType' yourself when reading the file. For example, if you have a .xls file, you can specify the Excel type as follows:
```
Workbook workbook = WorkbookFactory.create(new File("example.xls"), null, true);
```
Here, the third argument 'true' specifies that the file should be treated as an old Excel format (.xls). If you have a .xlsx file, you can specify the Excel type as follows:
```
Workbook workbook = WorkbookFactory.create(new File("example.xlsx"), null, true);
```
Here, the third argument 'false' specifies that the file should be treated as a new Excel format (.xlsx). By specifying the Excel type yourself, you can avoid any exceptions related to the Excel format.
阅读全文