This project is focused on simplifying the process of importing data from Excel files into your Laravel application. It includes features for secure file uploads, data validation, and real-time updates.
- Excel File Upload: Allow users to upload Excel files containing data for import.
- Data Validation: Implement validation checks to ensure the integrity and accuracy of imported data.
- CSRF Protection: Utilize Laravel's built-in CSRF protection for secure form submissions.
- Real-Time Updates: Display real-time updates to the user interface after importing data.
- PHP installed (8.1)
-
Clone the Repository:
git clone <repository-url> cd excel-import
-
Install Dependencies:
composer install
-
Install Maatwebsite/Laravel-Excel Package:
composer require maatwebsite/excel
-
Register Package Service Provider and Facade:
-
Open
config/app.php
and add the following lines:'providers' => [ // ... Maatwebsite\Excel\ExcelServiceProvider::class, ],
'aliases' => [ // ... 'Excel' => Maatwebsite\Excel\Facades\Excel::class, ],
-
-
Publish the Package Configuration:
php artisan vendor:publish --provider="Maatwebsite\Excel\ExcelServiceProvider"
This will create a
config/excel.php
file. -
Generate Application Key:
php artisan key:generate
-
Run Migrations:
php artisan migrate
-
Serve the Application:
php artisan serve
Access the application at http://localhost:8000.
-
Upload Excel File:
- Visit the designated page for Excel file uploads.
- Choose an Excel file from your local machine.
-
Data Validation:
- The system will perform validation checks on the uploaded data.
- Any validation errors will be displayed to the user.
-
Import Data:
- Once validated, proceed to import the data into the application.
- Real-time updates will be shown on the user interface.
To help you get started, here's a sample Excel file that you can use for testing the import functionality. The file should have the following format:
Name | Price |
---|---|
Product A | 10.99 |
Product B | 19.95 |
Product C | 5.49 |
Contributions are welcome! Feel free to open issues or pull requests.