Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To read Excel can we use Spring batch?

I want to know if it is possible to use Spring Batch, in order to read from an file Excel and save it in Database.

remark : the content of file Excel chang every 2 hours.

And if it is not possible with Spring Batch, what other solution can i use

like image 538
user3693890 Avatar asked Sep 06 '25 03:09

user3693890


2 Answers

Go take a look on spring-batch-extensions for Excel. You will find some examples of ExcelItemReader and ExcelItemWriter.

Here is the introduction of the spring-batch-extensions project for Excel :

Spring Batch extension which contains ItemReader implementations for Excel. Support for both JExcel and Apache POI is available. Simple xls documents can be read with both implementations, however for reading the newer xlsx format Apache POI is required.

You just need to import sources into your IDE and use them.

like image 164
youtix Avatar answered Sep 09 '25 16:09

youtix


<dependency>
    <groupId>org.springframework.batch.extensions</groupId>
    <artifactId>spring-batch-excel</artifactId>
    <version>0.1.0</version>
</dependency>

Above dependency can be added for as Excel Item Reader(PoiItemReader).

like image 42
arjun kumar Avatar answered Sep 09 '25 15:09

arjun kumar