Thanks for submitting the ticket. Unfortunately the information you provided is incomplete. We need to know which version you use and how to reproduce it. Please include code examples. Before we can pick it up, please check (https://github.com/Maatwebsite/Laravel-Excel/blob/3.0/.github/ISSUE_TEMPLATE.md) and add the missing information. To make processing of this ticket a lot easier, please make sure to check (https://laravel-excel.maatwebsite.nl/docs/3.0/getting-started/contributing) and double-check if you have filled in the issue template correctly. This will allow us to pick up your ticket more efficiently. Issues that follow the guidelines correctly will get priority over other issues.

这样可以解决, 但是不知道是否有更好的解决方案
Please translate to English.
I just want to use the first sheet to import. But sheet has 3, and 2 are empty. how can i Specify the imported sheet ? @patrickbrouwers @GlennM
You should use the WithMultipleSheets in that case.
namespace App\Imports;
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
class UsersImport implements WithMultipleSheets {
public function sheets(): array
{
return [
// Select by sheet index
0 => new FirstSheetImport(),
];
}
}
https://laravel-excel.maatwebsite.nl/3.1/imports/multiple-sheets.html
the problem is this

the answer solve my problem.
You should use the
WithMultipleSheetsin that case.namespace App\Imports; use Maatwebsite\Excel\Concerns\WithMultipleSheets; class UsersImport implements WithMultipleSheets { public function sheets(): array { return [ // Select by sheet index 0 => new FirstSheetImport(), ]; } }https://laravel-excel.maatwebsite.nl/3.1/imports/multiple-sheets.html
just do that.

thank you, @patrickbrouwers
how can i specify the imported sheet if i use v2.* ?
just do that. when using v2.* version.

Version 2.* is no longer supported.
Version 2.* is no longer supported.
yes . but this is old project.
You'll have to upgrade to 3.1 or use it on own risk. We can no longer support this outdated version which uses abandoned software (PHPExcel).
OK, thank you for your answer. @patrickbrouwers
Looks like collection() method doesn't work with WithMultipleSheets, because I didn't get "test" in the output. Is it right behavior? Or I do something wrong?
class ClientsImport implements ToCollection, WithHeadingRow, WithMultipleSheets
{
public function sheets(): array
{
return [
0 => new static
];
}
public function collection(Collection $rows)
{
echo 'test';
exit;
}
Version 2.* is no longer supported.
You'll have to upgrade to 3.1 or use it on own risk. We can no longer support this outdated version which uses abandoned software (PHPExcel).
Sir how can I implement the WithStartRow interface? I have an excel file with columns starting at row 5, now when I try to use the startRow function, it says Undefined index: Firtsname (my first column). Can you help me solve this issue. need to resolve this ASAP. Thanks in advance
Version 2.* is no longer supported.
You'll have to upgrade to 3.1 or use it on own risk. We can no longer support this outdated version which uses abandoned software (PHPExcel).
Sir how can I implement the WithStartRow interface? I have an excel file with columns starting at row 5, now when I try to use the startRow function, it says Undefined index: Firtsname (my first column). Can you help me solve this issue. need to resolve this ASAP. Thanks in advance
Could you open a new issue if needed according to the template, instead of replying to an older ticket, including some code?
Please check if you're using WithHeadingRow. In that case, you can use the column names.
Most helpful comment
the problem is this
the answer solve my problem.
just do that.
thank you, @patrickbrouwers