Excel Importer dependency for Laravel Enso
laravel-enso/data-import is a Laravel package for excel importer dependency for laravel enso.
It currently has 20 GitHub stars and 43.915 downloads on Packagist (latest version 6.11.5).
Install it with composer require laravel-enso/data-import.
Discover more Laravel packages by laravel-enso
or browse all Laravel packages to compare alternatives.
Last updated
Data Import adds template-driven spreadsheet imports to Enso.
The package validates uploaded files against JSON template definitions, splits work into queued jobs, tracks import progress and status, generates rejected-row workbooks when needed, and exposes the API endpoints required by the Enso import UI.
It supports multi-sheet XLSX imports as well as CSV and TXT imports, with configurable structure validation, queue separation, and retention policies.
Seeder-style imports can also resolve the acting Enso user through the configurable seederUserId setting, which is useful when imports are executed outside a regular authenticated request.
Install the package:
composer require laravel-enso/data-import
Run the package migrations:
php artisan migrate
Optional publishes:
php artisan vendor:publish --tag=data-import-config
php artisan vendor:publish --tag=data-import-factory
php artisan vendor:publish --tag=data-import-mail
php artisan vendor:publish --tag=data-import-examples
Register at least one import type in config/enso/imports.php:
'configs' => [
'userGroups' => [
'label' => 'User Groups',
'template' => 'app/Imports/Templates/userGroups.json',
],
],
If you use seed-style imports that need a tracked Enso user, configure the fallback user id:
'seederUserId' => env('DATA_IMPORT_SEEDER_USER_ID', 1),
The ExcelSeeder service uses this value to resolve the user passed into import hooks and track-who aware models when there is no authenticated session.
The package schedules these maintenance commands daily:
enso:data-import:purgeenso:data-import:cancel-stuckxlsx, csv, and txt uploads.laravel-enso/mails, including a download link for uploaded import files.Create an importer class that implements the package contract:
use LaravelEnso\DataImport\Contracts\Importable;
use LaravelEnso\DataImport\Models\Import;
use LaravelEnso\Helpers\Services\Obj;
class UserGroupImporter implements Importable
{
public function run(Obj $row, Import $import)
{
UserGroup::create($row->all());
}
}
Point a template configuration entry to a JSON template that defines sheets, columns, and the importer class. The package can then:
When the import runs through the seeder-oriented flow, the package resolves the acting user from config('enso.imports.seederUserId'). Set DATA_IMPORT_SEEDER_USER_ID to an Enso user that should own created records, approvals, and audit metadata produced by those imports.
POST api/import/storeDELETE api/import/{import}GET api/import/download/{import}GET api/import/initTableGET api/import/tableDataGET api/import/exportExcelPATCH api/import/{import}/cancelPATCH api/import/{import}/restartGET api/import/optionsGET api/import/{type}GET api/import/{type}/templateGET api/import/{rejected}/rejectedenso:data-import:purgeenso:data-import:cancel-stuckImportableBeforeHookAfterHookAuthenticatesAuthorizesRequired Enso packages:
laravel-enso/core ↗laravel-enso/dynamic-methods ↗laravel-enso/enums ↗laravel-enso/excel ↗laravel-enso/files ↗laravel-enso/helpers ↗laravel-enso/io ↗laravel-enso/mails ↗laravel-enso/migrator ↗laravel-enso/select ↗laravel-enso/tables ↗laravel-enso/track-who ↗Required external package:
Companion frontend package:
are welcome. Pull requests are great, but issues are good too.
Thank you to all the people who already contributed to Enso!