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]: When importing if I use WithCalculatedFormulas and WithMultipleSheets and associative array to select the sheets, error, when reference to another sheet: REF #4018

Closed
1 task done
Javiedu opened this issue Oct 24, 2023 · 2 comments

Comments

@Javiedu
Copy link

Javiedu commented Oct 24, 2023

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.48

What version of Laravel are you using?

10.18.0

What version of PHP are you using?

8.1.2

Describe your issue

In cell with this value: =$SHEET2.$O$57

With indexed array return correct value:

class ImportMultiple implements WithCalculatedFormulas, WithMultipleSheets
{
    public function sheets(): array
    {
        $temp = [
            0 => new ImportHoja(),
            2 => new ImportHoja(),
        ];

        return $temp;
    }
}

With associative array return #REF! error:

class ImportMultiple implements WithCalculatedFormulas, WithMultipleSheets
{
    public function sheets(): array
    {
        $temp = [
            "SHEET1" => new ImportHoja(),
            "SHEET3" => new ImportHoja(),
        ];

        return $temp;
    }
}

How can the issue be reproduced?

Importing xslm file with multiple sheets:

ImportHoja Class:

class ImportHoja implements ToArray, HasReferencesToOtherSheets, WithCalculatedFormulas
{
    public function array($row)
    {
        
    }

    public function collection($row)
    {
        
    }
}

Code:
$datosBruto = Excel::toCollection(new ImportMultiple, $file);

What should be the expected behaviour?

With associative array return correct value.

@Javiedu Javiedu added the bug label Oct 24, 2023
@patrickbrouwers
Copy link
Member

Could you create a failing unit test for this as PR?

@stale stale bot added the stale label Dec 26, 2023
Copy link

stale bot commented Dec 28, 2023

This bug report has been automatically closed because it has not had recent activity. If this is still an active bug, please comment to reopen. Thank you for your contributions.

@stale stale bot closed this as completed Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants