Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding write support to File_Format.Excel #3551

Merged
merged 26 commits into from
Jul 4, 2022

Conversation

jdunkerley
Copy link
Member

@jdunkerley jdunkerley commented Jun 28, 2022

Pull Request Description

Support for writing tables to Excel.

Important Notes

Has custom support for Error mode as will allow appending a new table in this mode to the file.

Checklist

Please include the following checklist in your PR:

  • The documentation has been updated if necessary.
  • All code conforms to the
    Scala,
    Java,
    and
    Rust
    style guides.
  • All code has been tested:
    • Unit tests have been written where possible.

@jdunkerley jdunkerley requested a review from hubertp June 28, 2022 14:20
@jdunkerley jdunkerley force-pushed the wip/jd/excel-write-182309816 branch from 3b5dca5 to 51a19d7 Compare June 30, 2022 16:51
@jdunkerley jdunkerley marked this pull request as ready for review June 30, 2022 16:54
@jdunkerley jdunkerley force-pushed the wip/jd/excel-write-182309816 branch from b85ad70 to 37d6a67 Compare July 1, 2022 13:08
Copy link
Member

@JaroslavTulach JaroslavTulach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the example with date in CSV files.

for these tests. This should ideally be re-enabled with the
completion of the following story:
https://www.pivotaltracker.com/story/show/181755990
no_dates = File_Format.Delimited "," value_formatter=(Data_Formatter date_formats=[] time_formats=[] datetime_formats=[])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. How would one enable parsing of the dates again? Probably by avoiding value_formatter specification...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly - if value_formatter is not set it should automatically parse date in the format of yyyy-MM-dd

Alternatively:
no_dates = File_Format.Delimited "," value_formatter=(Data_Formatter date_formats=['yyyy-MM-dd'] time_formats=[] datetime_formats=[])
would just re-enable dates (leaving DateTimes and Times as text).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How shall I run the test? I tried:

enso$ ./built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/bin/enso --run  test/Table_Tests/src/Excel_Spec.enso
In module Excel_Spec:
Compiler encountered errors:
Excel_Spec.enso[18:1-18:19]: The `project` keyword was used in an import statement, but the module does not belong to a project.
Execution finished with an error: Compilation aborted due to errors.

I deleted the 18th line, but then most of the tests fail.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need the --in-project argument:

Windows:
.\bin\enso --ir-caches --run C:\Repos\Enso\ide\test\Table_Tests\src\Excel_Spec.enso --in-project C:\Repos\Enso\ide\test\Table_Tests

test/Table_Tests/src/Excel_Spec.enso Show resolved Hide resolved
Test.specify 'should result in Range_Exceeded error if trying to write in too small a range' <|
out.delete_if_exists
(Enso_Project.data / test_sheet_name) . copy_to out
sub_clothes.write out (File_Format.Excel (Cell_Range "Another!A1:B2")) . should_fail_with Range_Exceeded
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the target file modified? I'd like the test to check that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do with a File get_modified_time but as lacking that will hold off adding for now. Will add as part of append.

Copy link
Member

@radeusgd radeusgd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me overall, some comments and questions (possibly for future) in-line.

The major thing that I think should be addressed before merging is that documentation of Existing_File_Behavior.Error is not consistent with the behavior for Excel files. While I understand the rationale behind the changed behavior, I don't think we can have documentation that is not aligned with the actual behavior as that will greatly confuse the users, so I think we need to figure something out for this case.

@jdunkerley jdunkerley requested a review from radeusgd July 4, 2022 15:18
@jdunkerley jdunkerley force-pushed the wip/jd/excel-write-182309816 branch from 4733e64 to 5e0a68e Compare July 4, 2022 15:58
…java

Co-authored-by: Radosław Waśko <radoslaw.wasko@enso.org>
@jdunkerley jdunkerley added the CI: Ready to merge This PR is eligible for automatic merge label Jul 4, 2022
@mergify mergify bot merged commit 4ca2097 into develop Jul 4, 2022
@mergify mergify bot deleted the wip/jd/excel-write-182309816 branch July 4, 2022 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants