All Projects → Coreoz → Windmill

Coreoz / Windmill

Licence: Apache-2.0 license
A library to parse or write Excel and CSV files through a fluent API

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Windmill

java-read-write-csv-file
Read and Write CSV files in Java using Apache Commons CSV and OpenCSV
Stars: ✭ 57 (+200%)
Mutual labels:  csv-parser, csv-reader, csv-writer
VBA-CSV-interface
The most powerful and comprehensive CSV/TSV/DSV data management library for VBA, providing parsing/writing capabilities compliant with RFC-4180 specifications and a complete set of tools for manipulating records and fields.
Stars: ✭ 24 (+26.32%)
Mutual labels:  csv-parser, csv-reader, csv-writer
Cursively
A CSV reader for .NET. Fast, RFC 4180 compliant, and fault tolerant. UTF-8 only.
Stars: ✭ 34 (+78.95%)
Mutual labels:  csv-parser, csv-reader
pikaz-excel-js
一个纯js版本的excel导入导出插件
Stars: ✭ 145 (+663.16%)
Mutual labels:  excel-import, excel-export
abap2xlsx
Generate your professional Excel spreadsheet from ABAP
Stars: ✭ 493 (+2494.74%)
Mutual labels:  excel-import, excel-export
lazycsv
A fast, lightweight and single-header c++ csv parser library
Stars: ✭ 53 (+178.95%)
Mutual labels:  csv-parser, csv-reader
csvlixir
A CSV reading/writing application for Elixir.
Stars: ✭ 32 (+68.42%)
Mutual labels:  csv-parser, csv-export
csv
The csv read/write tool based on java annotation.(基于 java 注解的 CSV 文件读写框架工具。)
Stars: ✭ 22 (+15.79%)
Mutual labels:  csv-reader, csv-export
CsvTextFieldParser
A simple CSV parser based on Microsoft.VisualBasic.FileIO.TextFieldParser.
Stars: ✭ 40 (+110.53%)
Mutual labels:  csv-parser, csv-reader
Csv Parser
Fast, header-only, extensively tested, C++11 CSV parser
Stars: ✭ 90 (+373.68%)
Mutual labels:  csv-parser
Cassava
A CSV parsing and encoding library optimized for ease of use and high performance
Stars: ✭ 193 (+915.79%)
Mutual labels:  csv-parser
Csvparser
A swift package for read and write CSV file
Stars: ✭ 73 (+284.21%)
Mutual labels:  csv-parser
Csv Stream
📃 Streaming CSV Parser for Node. Small and made entirely out of streams.
Stars: ✭ 98 (+415.79%)
Mutual labels:  csv-parser
Intellij Csv Validator
CSV validator, highlighter and formatter plugin for JetBrains Intellij IDEA, PyCharm, WebStorm, ...
Stars: ✭ 198 (+942.11%)
Mutual labels:  csv-parser
Ngx Papaparse
Papa Parse wrapper for Angular
Stars: ✭ 83 (+336.84%)
Mutual labels:  csv-parser
excel-csvexporter
Lightweight tool to export ranges within an Excel sheet to CSV
Stars: ✭ 32 (+68.42%)
Mutual labels:  excel-export
Csv File Validator
🔧🔦 Validation of CSV file against user defined schema (returns back object with data and invalid messages)
Stars: ✭ 60 (+215.79%)
Mutual labels:  csv-parser
Csv
Fast C# CSV parser
Stars: ✭ 53 (+178.95%)
Mutual labels:  csv-parser
flextures
This plug-in can load and dump test data in databases, loading function is very flexible, dump function is very simple
Stars: ✭ 21 (+10.53%)
Mutual labels:  csv-export
Tinycsvparser
Easy to use, easy to extend and high-performance library for CSV parsing with .NET
Stars: ✭ 247 (+1200%)
Mutual labels:  csv-parser

Windmill

Build Status Coverage Status Maven Central

Windmill is a library to parse or write Excel and CSV files through a fluent API that takes advantage of Java 8 Stream and Lambda features.

Windmill targets the writing/parsing of List/Collection data. It will especially stand out for use cases like exporting/importing a result set from/to a database.

It is based on the projects Apache POI and OpenCSV to manipulate Excel and CSV files.

Getting started

Include Windmill in your project:

<dependency>
  <groupId>com.coreoz</groupId>
  <artifactId>windmill</artifactId>
  <version>1.2.0</version>
</dependency>

Import/Parsing

Here is an import example:

try (Stream<Row> rowStream = Windmill.parse(FileSource.of(new FileInputStream("myFile.xlsx")))) {
  rowStream
    // skip the header row that contains the column names
    .skip(1)
    .forEach(row -> {
      System.out.println(
        "row n°" + row.rowIndex()
        + " column 'User login' value : " + row.cell("User login").asString()
        + " column n°3 number value : " + row.cell(2).asDouble().value() // index is zero-based
      );
    });
}

Note that the try statement is required to close the Stream if the InputStream used should be closed.

Options can be passed to the parser. For example with Excel workbooks, it is possible to select the spreadsheet to use, or to specify that cell values should be trimmed:

Stream<Row> rowStream = Parsers
  .xlsx("User sheet")
  .trimValues()
  .parse(FileSource.of(new FileInputStream("myFile.xlsx")));

With CSV files, it is possible to specify multiple parameters like the charset or the escape character:

Stream<Row> rowStream = Parsers
  .csv(CsvParserConfig.builder().charset(StandardCharsets.UTF_8).separator(';').build())
  .parse(FileSource.of(new FileInputStream("myFile.csv")));

Export/Writing

Here is an export example:

Windmill
  .export(Arrays.asList(bean1, bean2, bean3))
  .withHeaderMapping(
    new ExportHeaderMapping<Bean>()
      .add("Name", Bean::getName)
      .add("User login", bean -> bean.getUser().getLogin())
  )
  .asExcel()
  .writeTo(new FileOutputStream("Export.xlsx"));

Options can be passed to the exporter, for example with CSV files, it is possible to specify multiple parameters like the separator character or the escape character:

Windmill
  .export(Arrays.asList(bean1, bean2, bean3))
  .withNoHeaderMapping(Bean::getName, bean -> bean.getUser().getLogin())
  .asCsv(ExportCsvConfig.builder().separator(';').escapeChar('"').build());
  .toByteArray();

It is also possible to export multiple tabs in one Excel workbook:

Workbook xlsxFile = new XSSFWorkbook();

Windmill
  .export(Arrays.asList(bean1, bean2, bean3))
  .withNoHeaderMapping(Bean::getName, bean -> bean.getUser().getLogin())
  .asExcel(ExportExcelConfig.fromWorkbook(xlsxFile).build("First tab"))
  .write();

Windmill
  .export(Arrays.asList(film1, film2))
  .withNoHeaderMapping(Film::getTitle, Film::getReleaseDate)
  .asExcel(ExportExcelConfig.fromWorkbook(xlsxFile).build("Second tab with films"))
  .write();

xlsxFile.write(new FileOutputStream("Export.xlsx"));
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].