Replies: 1 comment
-
Not sure that's something I can add as a fix within 3.1 as this would technically be a breaking change. If people currently rely on it being the numeric keys, their code will break if we change it to sheet names. If you make a PR which doesn't introduce this as a breaking change, I'm happy to have a look at it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When you import a document with multiple sheets using toCollection and a generic import, the titles of the sheets are ignored. For example, if you had an import class as follows:
You also have a sheet
testSheet.xlsx
with "Income", "Assets" and "Report" as separate sheets.My expectation is that running
$collection = Excel::toCollection(new MyImport, 'testSheet.xlsx');
would result in a Collection with 3 nested collections, and the keys of that collection would be "Income", "Assets", and "Report". Explicitly,$collection->keys()->toArray()
should result in['Income', 'Assets', 'Report']
. Instead, you get a Collection with 3 child collections, but no associative keys:[0,1,2]
.I understand that in most cases you want an import to run through a WithMultipleSheets concern, but my use case is testing. If I feature test a Job that creates an export, it would be very useful to be able to test that the resulting sheet has the correct content and titles without needing to reconstruct the whole Export structure as an import. The Facade (::fake()) won't work for my use case, because faking results in no file created, and I need that file in order to complete the job.
I'll dig in and PR, just wanted to get a discussion going!
Beta Was this translation helpful? Give feedback.
All reactions