-
Notifications
You must be signed in to change notification settings - Fork 13
feat: implement formula support for excel imports #1020
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
feat: implement formula support for excel imports #1020
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for handling!
For me the attached sheet (upload as supplier after ./deploy.sh -ci) fails.
It contains the following formula functions:
- TEXT
- VLOOKUP
- NOW
It leads to an error and the following log message:
2025-10-13T08:16:02.976Z WARN 1 --- [nio-8081-exec-5] o.apache.poi.ss.formula.FormulaParser : FormulaParser.function: Name '_xlfn.UNIQUE' is completely unknown in the current workbook.
The interesting part likely is that there is data pulled from a second sheet in the same workbook. I've not used the Unique function. This may be implied by using
delivery-template-example.xlsx
VLOOKUP. Could you give it a check? Because that's exactly the use case we try to solve.
backend/src/main/java/org/eclipse/tractusx/puris/backend/file/logic/service/ExcelService.java
Show resolved
Hide resolved
Thank you for the example. I've taken a quick look and, as the error message suggests, the issue is actually none of the Formula functions you've listed, but Fixing it reveals some other issues in the sheet though. The data incorrectly lists the supplier's BPNL as partnerBpnl. As of writing it also has lastUpdatedOnDateTime set to be at 23:59:59 today, which is invalid as the date needs to be in the past. With the updated documentation according to your other comment, I would suggest omitting the use of |
You're right I missed that table (and search for Unique had no hit)!
I did the fixes. Interestingly with the formulas evaluated in a line the quantity is not passed as numeric anymore. I attached version 2 of the file. get the error in the upload "Cannot get a NUMERIC value from a STRING cell Further validations for this row are not possible." delivery-template-example2.xlsx
I'm with you here! |
b6f94a1 to
8951b78
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot. One more question, because I found something confusing. I think we can't easily change it programatically, but it might be worth a further note in the user guide. I would love to get your thought on it; I'm also fine with the current solution.
I expanded the example to lookup the quantity value (realistic scenario):
delivery-template-example3.xlsx
The lookup works from data:C2 to Support Table:K2.
- If I format data:C2 as Number, then it works
- If I format Support Table:K2 as Number, too, then it doesn't work (attached this as v3)
The error is OK from my point of view:
We might need to add something to the user guide like: "When using formulas, please ensure that the final cell is correctly formatted (e.g. quantities as number). If you lookup values (e.g. VLOOKUP), the cell to perform a lookup on must be formatted as general."
I've addressed the issue. Lookups should now work with the correct cell types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! Small change in code but tedieous to test and big impact!
|
@ReneSchroederLJ I can't resolve the conflicts. Could you please update the branch / merge main? |
e991929 to
47419f8
Compare
Description
resolves #1016
Pre-review checks
Please ensure to do as many of the following checks as possible, before asking for committer review: