Trying to read an excel file using Spring Webflux . Taking the input as Flux and streaming the data . Its working with 6k rows but any more rows it fails with error .
“OOXML file structure broken/invalid – no core document found!”
Can someone explain this error or what could be the cause for this.
<code>@SneakyThrows
public Mono<Void> parseExcel(
Flux<Part> file, String updatedBy, String fileName) {
return file
.flatMap(attributes
-> attributes.content().flatMap(content -> {
List<DTO> rows = new ArrayList<>(fromExcel(content.asInputStream(),
PoijiExcelType.XLSX, DTO.class, Util.ExcelOptions()));
log.info(
"rows extracted form excel {}", rows.size());
AtomicInteger successCounter = new AtomicInteger(0);
Set<String> errors = new HashSet<>();
return validate(rows, updatedBy, errors, successCounter)
.then(Mono.fromRunnable(()
-> sendEmail(rows.size(), fileName,
successCounter.get(), errors)));
}),
concurrency, prefetch)
.then();
}
</code>
<code>@SneakyThrows
public Mono<Void> parseExcel(
Flux<Part> file, String updatedBy, String fileName) {
return file
.flatMap(attributes
-> attributes.content().flatMap(content -> {
List<DTO> rows = new ArrayList<>(fromExcel(content.asInputStream(),
PoijiExcelType.XLSX, DTO.class, Util.ExcelOptions()));
log.info(
"rows extracted form excel {}", rows.size());
AtomicInteger successCounter = new AtomicInteger(0);
Set<String> errors = new HashSet<>();
return validate(rows, updatedBy, errors, successCounter)
.then(Mono.fromRunnable(()
-> sendEmail(rows.size(), fileName,
successCounter.get(), errors)));
}),
concurrency, prefetch)
.then();
}
</code>
@SneakyThrows
public Mono<Void> parseExcel(
Flux<Part> file, String updatedBy, String fileName) {
return file
.flatMap(attributes
-> attributes.content().flatMap(content -> {
List<DTO> rows = new ArrayList<>(fromExcel(content.asInputStream(),
PoijiExcelType.XLSX, DTO.class, Util.ExcelOptions()));
log.info(
"rows extracted form excel {}", rows.size());
AtomicInteger successCounter = new AtomicInteger(0);
Set<String> errors = new HashSet<>();
return validate(rows, updatedBy, errors, successCounter)
.then(Mono.fromRunnable(()
-> sendEmail(rows.size(), fileName,
successCounter.get(), errors)));
}),
concurrency, prefetch)
.then();
}
I am hoping there can someway to process this with above 200k rows