Laravel Excel import from few sheets

Viewed 54

I have a problem importing from several sheets at once, in one of them I have data that I need to compare with the data in the other sheet and then upload to the database. I use Laravel Excel and read the documentation several times but I still can't find a reasonable solution. I do not want to split sheets and only be able to use the data from the sheets at the same time.

class FameImport implements WithMultipleSheets
{
    public function sheets(): array {
        return [
            1 => new LabelSheet(),
            2 => new DataSheet()
        ];
    }
}

class LabelSheet implements ToCollection, WithStartRow, WithHeadingRow {

    public function collection(Collection $collection)
    {
        return $collection;
    }

    public function startRow(): int
    {
        return 8;
    }
}

class DataSheet implements ToCollection {

    public function collection(Collection $collection)
    {
        dd($collection);
    }
}

0 Answers
Related