Broadleaf Microservices
  • v1.0.0-latest-prod

Import File Type Support

Comma-separated Values (CSV)

CSV files are parsed by the CSVFileReader using the Univocity CSV Parser. Most of the features exposed within the import services and file reading are based on features provided in Univocity.

Requirements:

  • All files must have a 'header' line so that each row can be parsed into a Map<String, String> of data, where the header is the key, and the cell value is the value

Escape Characters

The default delimiter is a comma ,. If you have data that has a comma inside it, surround the entire cell value with quotes.

Nested Commas Example
name,description,defaultPrice
Product 1,"The description has item1, item2, item3",9.99

The description field will be parsed as The description has item1, item2, item3.

If you have data that has quotes in it, they can be escaped with another quote.

Nested Quotes Example
name,description,defaultPrice
Product 1,"The description has item1, item2, ""item3""",9.99

The description field will be parsed as The description has item1, item2, "item3".

Excel

Excel files are parsed by the XLSFileReader using Apache POI, but this is disabled by default. To enable Excel parsing, simply add the Apache POI libraries to your project:

<dependency>
  <groupId>org.apache.poi</groupId>
  <artifactId>poi-ooxml</artifactId>
  <version>3.15</version>
</dependency>