Skip to content

Design Document: Import from Excel

Dmitry Barashev edited this page Apr 6, 2017 · 1 revision

Summary

We'd like to be able to import GanttProject data from Excel files in addition to already existing CSV import. This document describes user interface and technical aspects of the implementation.

In short, the task comes down to relatively small refactoring of the core CSV importing code.

User interface

Currently user can choose CSV import in the list of all available importers. We'd like to keep it the same and just the ability to guess file type from file extension. This is similar to how import from MS Project works.

Program interface

CSV import uses Apache Commons CSV library and in particular its CSVParser and CSVRecord classes. There is a lot of non-trivial code in the export which we want to keep and don't want to duplicate. It seems that replacing CSVParser and CSVRecord classes with minimal required abstract interface and parameterizing CSV importer with implementation of that interface will make possible to reuse the code of importer for both CSV and Excel exports.

This approach was already successfully implemented in CSV Export code. Refer to the pull request for the details of refactoring in CSV export.

Technical details

Relevant classes in GanttProject codebase:

  • GanttCSVOpen -- the meat of CSV import, scans through the input records and makes their semantical analysis
  • ImporterFromCsvFile -- plugs into the import wizard UI

Source code location

This feature should eventually be merged into master and published in one of the future versions. The base integration branch for pull requests is prj2_master. Please fork from this base branch and create pull request into this base branch.

We use Java 8 and Kotlin, feel free to choose the language and feel free to use modern features of Java 8 if needed.

Tests

We'll appreciate a few unit tests similar to already existing GPCsvImportTest. Probably it would make sense to refactor test code so that it could be reused for both Excel and CSV input data.

Source code modification process

The process is described on GanttProject doc pages. Please do follow the code style and code review process. Your code should be of high quality in both operational and reading aspects (that is, it should work and it should be readable to us), and please be prepared to pretty demanding code review.