PHP code example of coolsam / excel-import

1. Go to this page and download the library: Download coolsam/excel-import library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

coolsam / excel-import example snippets


return [
    'accepted_mimes' => [
        'application/vnd.ms-excel',
        'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
        'text/csv',
        'text/plain',
        'csv',
        'txt',
    ],
    'temporary_files' => [
        'disk' => 'local',
        'directory' => 'coolsam-excel',
    ],
];

    use Coolsam\FilamentExcel\Actions\ImportAction;
    use Coolsam\FilamentExcel\Actions\ImportField;
    protected function getHeaderActions(): array
    {
        return [
            ImportAction::make('users')->fields([
                ImportField::make('name')->

use Coolsam\FilamentExcel\Actions\ImportField;
use Coolsam\FilamentExcel\Actions\Tables\ImportAction;

    $table->headerActions([
        ImportAction::make('import users')
            ->fields([
                ImportField::make('name')->))
    ])

    $table->headerActions([
        ImportAction::make('import users')
            ->fields([
                ImportField::make('name')->> User::updateOrCreate(
                ['email' => $data['email']],
                $data
            ))
    ])

    $table->headerActions([
        ImportAction::make('import users')
            ->fields([
                ImportField::make('name')->     ['email' => $data['email']],
                $data
            ))
    ])
bash
php artisan vendor:publish --tag="coolsam-excel-config"