Importing TSV tab delimited content using Filament Import Action

Hello,
I'm trying to allow the importing of tab-delimited content in a TSV file using the ImportAction in a getHeaderActions function.

Here's my code:
protected function getHeaderActions(): array
{
    $fileImports = ImportAction::make('import_data')
        ->importer(StudentImporter::class)
        ->csvDelimiter("\t")
        ->fileRules([
            File::types(['csv', 'tsv', 'txt'])->max(1024),
        ]);

    return [
        $fileImports,
        Action::make('import_device_returns'),
    ];
}


I'm running into two issues.
First, it's rejecting files with a tsv extension. It returns the error "Expects text/csv, text/x-csv, application/csv, application/x-csv, text/comma-separated-values, text/x-comma-separated-values, text/plain or application/vnd.ms-excel".
Second, if I upload a txt file, it's ignoring the \t csvDelimiter option, it sees the header row as 1 long entry.

I feel like I may be missing something obvious, but I've searched (Stackoverflow/Github) for importing TSV files and haven't been able to find anything.

Any help is appreciated.
Screenshot_2025-01-27_at_11.57.53.png
Screenshot_2025-01-27_at_11.59.56.png
Was this page helpful?