https://github.com/dynamiatools/module-importer
DynamiaTools extension to work with excel files for import data
https://github.com/dynamiatools/module-importer
data dynamia excel import java zk
Last synced: 4 months ago
JSON representation
DynamiaTools extension to work with excel files for import data
- Host: GitHub
- URL: https://github.com/dynamiatools/module-importer
- Owner: dynamiatools
- License: apache-2.0
- Created: 2020-12-04T14:04:22.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-07-02T15:32:00.000Z (11 months ago)
- Last Synced: 2025-08-05T01:06:35.927Z (10 months ago)
- Topics: data, dynamia, excel, import, java, zk
- Language: Java
- Homepage: https://dynamia.tools
- Size: 298 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://search.maven.org/search?q=tools.dynamia.modules.importer)

[](https://github.com/dynamiatools/module-importer/actions/workflows/maven.yml)
# Importer Module
This [DynamiaTools](https://dynamia.tools) extension allow you easily import and process Excel files. It provides async
upload and processing, progress monitor, allow user to stop importing process and more.
You can add your own `ImportAction` to process other file types
## Modules
- Core: Entities, Services and API implementation
- UI: Actions and views for user interface integration.
## Installation
Add the following dependencies to project classpath
**Maven**
```xml
tools.dynamia.modules
tools.dynamia.modules.importer
3.3.0
```
```xml
tools.dynamia.modules
tools.dynamia.modules.importer.ui
3.3.0
```
**Gradle**
```groovy
compile 'tools.dynamia.modules:tools.dynamia.modules.importer:3.3.0'
compile 'tools.dynamia.modules:tools.dynamia.modules.importer.ui:3.3.0'
```
## Usage
The `Importer` class is a ZK `Window` to show user the Excel format they need to import and show actions to process the
file. You can map columns to POJO properties
```java
import tools.dynamia.actions.ActionEvent;
import tools.dynamia.crud.AbstractCrudAction;
import tools.dynamia.modules.importer.ui.Importer;
import tools.dynamia.modules.importer.ImportExcelAction;
import myproject.Person;
@InstallAction
class ImportPeopleAction extends AbstractCrudAction {
public ImportPeopleAction() {
setName("Import");
setApplicableClass(Person.class);
}
public void actionPerformed(ActionEvent evt) {
var importer = new Importer();
importer.addColumn("Code");
importer.addColumn("Name");
importer.addColumn("Last Name", "name2"); //map to property name2
importer.addColumn("Start Date", "dateOfStart");
importer.addAction(new ImportPeopleAction()); //custom import action
importer.show("Import People"); // show the import window to user
}
}
class ImportPeopleAction extends ImportExcelAction {
@Override
public List importFromExcel(InputStream excelFile, ProgressMonitor monitor) throws Exception {
var result = new ArrayList();
ImportUtils.readExcel(excelFile, monitor, row -> {
var code = ImportUtils.getCellValue(row, 0); //get string value from column A
var name = ImportUtils.getCellValue(row, 1); //get string value from column B
var lastName = ImportUtils.getCellValue(row, 2); //get string value from column C
var startDate = ImportUtils.getCellValueObject(row, 3); //get object value from column D
var person = new Person();
person.setCode(code);
person.setName(name);
person.setName2(lastName);
if (startDate instanceof Date) {
person.setDateOfStart((Date) startDate);
}
result.add(person);
});
return result;
}
}
```
## License
DynamiaTools Importer is available under Apache 2 License