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

[Bug]: Formula is not calculated even after WithCalculatedFormulas, HasReferencesToOtherSheets #4187

Open
1 task done
thenibirahmed opened this issue Aug 15, 2024 · 0 comments
Labels

Comments

@thenibirahmed
Copy link

Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?

  • Yes, it's still reproducable

What version of Laravel Excel are you using?

3.1

What version of Laravel are you using?

11

What version of PHP are you using?

8.3

Describe your issue

In one file when I'm trying to read data by

class ProductImport implements WithMultipleSheets, WithCalculatedFormulas, HasReferencesToOtherSheets
{
    public Collection $excelData;
  
    protected $filePath;
 
    public function __construct($filePath)
    {
        $this->filePath = $filePath;
        $this->excelData = collect();
    }

  
    public function sheets(): array
    {
        $reader = new XlsxReader();
        $spreadsheet = $reader->load($this->filePath);
     }
}

It's getting with calculated formula

But when directly

class ProductImportToStaging implements ShouldQueue, ToModel, WithBatchInserts, WithChunkReading, WithStartRow, SkipsEmptyRows, WithCalculatedFormulas, HasReferencesToOtherSheets
{
    public function model(array $row)
    {
         ray($row)
    }
}

The formulas are not calculated, returned empty strings.

Formula example:=IF(Introduction!$D$41=""'"'',(1-Introduction!SD$41)*Prices!D9)

How can the issue be reproduced?

Just have a complex formula as I've given in examplethe

What should be the expected behaviour?

The value should be calculated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant