8000 Update mapped-cells.md · anthony-dee/laravel-excel-docs@bac0649 · GitHub
[go: up one dir, main page]

Skip to content

Commit bac0649

Browse files
Update mapped-cells.md
1 parent cf3802f commit bac0649

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

3.1/imports/mapped-cells.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,43 @@ class UsersImport implements WithMappedCells, ToModel
4444
::: warning
45 8000 45
This concern is not meant to map **columns**, only specific **cell** reference are allowed.
4646
:::
47+
48+
## Multi-demensional Mapping
49+
50+
In case you have repeating data in your table, e. g. a spreadsheet looking like this:
51+
52+
| Team 1 | | Team 2| |
53+
|-|-|-|-|
54+
| Max | 2 | Peter | 3 |
55+
| Annie | 0 | Alex | 1 |
56+
57+
you are also able to define cell coordinates in a nested array:
58+
59+
```php
60+
public function mapping(): array
61+
{
62+
return [
63+
'team1' => [
64+
[
65+
'name' => 'A2',
66+
'score' => 'B2',
67+
],
68+
[
69+
'name' => 'A3',
70+
'score' => 'B3',
71+
],
72+
],
73+
'team2' => [
74+
[
75+
'name' => 'C2',
76+
'score' => 'D2',
77+
],
78+
[
79+
'name' => 'C3',
80+
'score' => 'D3',
81+
],
82+
],
83+
];
84+
}```
85+
86+
Note that an array of the same form will be returned.

0 commit comments

Comments
 (0)
0