easyexcel icon indicating copy to clipboard operation
easyexcel copied to clipboard

csv通过流的方式去解析扔出 "Convert excel format exception.You can try specifying the 'excelType' yourself"异常

Open wo-wo-wo opened this issue 3 years ago • 8 comments

场景: 通过这种方式去远程获取流然后去解析读文件格式会识别不出来文件类型 EasyExcel.read(new URL("url").openStream()).build();

异常代码 ExcelTypeEnum#recognitionExcelType image

最新版本3.1.1 一样扔出的这个异常,magic 识别有问题

Originally posted by @wo-wo-wo in https://github.com/alibaba/easyexcel/issues/2495#issuecomment-1242767230

wo-wo-wo avatar Sep 10 '22 16:09 wo-wo-wo

same,我也遇到了

yourkevin avatar Sep 13 '22 09:09 yourkevin

最新版中csv通过file可以直接读取,通过流需要EasyExcel.read(......).excelType(ExcelTypeEnum.CSV)....指定excelType,且不能使用multipartFile.getInputStream()的流,需要转成file的流Files.newInputStream(file.toPath())

coder-movers avatar Sep 27 '22 07:09 coder-movers

最新版中csv通过file可以直接读取,通过流需要EasyExcel.read(......).excelType(ExcelTypeEnum.CSV)....指定excelType,且不能使用multipartFile.getInputStream()的流,需要转成file的流Files.newInputStream(file.toPath())

正解。我升级到3.1.1 是可以的,Thx

liquanjin avatar Oct 21 '22 01:10 liquanjin

我的 csv 识别出来的byte[] 为 [68, 97, 116, 101, 44, 67, 111, 117], 而非枚举中的 [-27, -89, -109, -27]

dragonorant avatar Nov 01 '22 09:11 dragonorant

我的 csv 识别出来的byte[] 为 [68, 97, 116, 101, 44, 67, 111, 117], 而非枚举中的 [-27, -89, -109, -27]

一样的,我是[-47,-7, -79, -66, 105, 100, 44, -53]

cshzz avatar Jun 08 '23 07:06 cshzz

我使用了Files.newInputStream新的流,并且在read时指定了excelType。但是我还是读取xls报错了。 Invalid header signature; read 0x6576206C6D783F3C, expected 0xE11AB1A1E011CFD0 我只有读取xlsx是没问题的,要读取csv和xls都需要在wps里面先转成xlsx,这样就没问题

panicknight avatar Nov 07 '23 03:11 panicknight

以上CSV导入后报错Convert excel format exception.You can try specifying the 'excelType' yourself的问题,需要升级jar版本至3.3.2,即可解决该问题!

Yan-Chuan-zir avatar Mar 28 '24 06:03 Yan-Chuan-zir