-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
How can I import calculated values? #1871
Comments
Hi @cosecantt , Here we've listed the available concerns. Please try the It's true that this one doesn't have any documentation example yet, so feel free to make a PR for the documentation. |
Thank you @GlennM . Please check the code above and I have tried with
but does not return the calculated value. Above ImportProduct class implements WithCalculatedFormulas or am I missing something. Is that enough to implemement WithCalculatedFormulas like above? |
|
This is the (working) tests we have for it : https://github.com/Maatwebsite/Laravel-Excel/blob/3.1/tests/Concerns/WithCalculatedFormulasTest.php If you find any issue with it, it'd be great if you could commit a failing tests. Makes it easier to figure things out. |
@patrickbrouwers, I debugged and it does not call the line you mentioned. When it calls it works as expected. I think $calculateFormulas always returns false. |
FYI: I got a calculated formula in my import (instead of the formula) by just adding I didn't set anything like E.g. the code I used to test:
|
@GlennM can you check the output of
|
That one has the formula (so not the calculated value):
|
@GlennM, is that expected or a bug? I guess it shoud return calculated value once WithCalculatedFormulas concern is implemented. |
@cosecantt feel free to submit a PR with a failing test for it. And if you figure out what causes it to not work, feel free to PR that too :) |
Closing as PR was made by @vega231 |
Hi there, not sure if im allowed to response after such a long time. I have added the 'use Maatwebsite\Excel\Concerns\WithCalculatedFormulas;' |
There probably is an error while trying to get the calculated value, so it falls back to the formula. You could put a |
Hey thanks for your quick reply. |
I have the same problem. I'm trying to import a spreadsheet with string, date and values filled by formulas. |
$event->sheet->setCellValueExplicit( This should do the trick.. |
Ran into the same issues until I saved my Excel file. Geez |
Prerequisites
Versions
Description
How can I import calculated values?
Imported excel file returns following values and the formula is not calculated for maximum_stock:
Additional Information
I set config
but it seems that above config missing for import
Or am I missing something in the code. Cannot find example on documentation. Thanks!
The text was updated successfully, but these errors were encountered: