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]: Merged Cells Not Detected in Laravel Excel Import #4243

Open
1 task done
MartienB opened this issue Nov 14, 2024 · 0 comments
Open
1 task done

[Bug]: Merged Cells Not Detected in Laravel Excel Import #4243

MartienB opened this issue Nov 14, 2024 · 0 comments
Labels

Comments

@MartienB
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.59

What version of Laravel are you using?

10.48.22

What version of PHP are you using?

8.2.25

Describe your issue

I'm having issues with correctly importing a xlsx file containing (vertically) merged cells. If a cell is merged I want to unmerge it and set the value of the original merged cell. However I'm unable to retrieve the ranges of merged cells.

Question/Request for Help:
Is there a known workaround or specific setting that I can apply to detect merged cells directly from the imported file? Any advice or insights would be greatly appreciated.

Thank you for looking into this!

Let me know if you’d like any adjustments to the report or additional details added!

How can the issue be reproduced?

I'm using the registerEvents() function to register a beforeSheet event (I've also tried afterSheet, beforeImport and afterImport).

Then I get the worksheet like this:
$worksheet = $event->sheet->getDelegate();

And try to get the merged cells:
$mergedCells = $worksheet->getMergeCells();

However $mergedCells is always empty. My code seems to be working when I first manually call $worksheet->mergeCells('K4:K7');. But as you can understand this is not a solution to this problem.

What should be the expected behaviour?

Merged cells should be detected directly from the imported file without needing to manually specify them in the code.

@MartienB MartienB added the bug label Nov 14, 2024
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