How to Import Excel Data in Laravel and Insert into Database
HTML-код
- Опубликовано: 28 сен 2024
- Learn How to importing data from Excel Speedsheet by using Maatwebsite package in Laravel and insert into Mysql database. How to import excel file data in Laravel using Maatwebsite package. How to import Excel file into Mysql database in Laravel framework.
For Source Code - www.webslesson...
I am using version "laravel/framework": "^6.2", Excel package is not working getting this error {message: "Call to undefined method Maatwebsite\Excel\Excel::load()",…} please help
pls help me push git :( i cant (In ProviderRepository.php line 208:
Class 'Maatwebsite\Excel\ExcelServiceProvider' not found )
Hi v good video but I need to compare vetween excel file and my database file I mean am not need to insert it in my database
Call to undefined method Maatwebsite\Excel\Excel::load() error
Follow this Guide
bishrulhaq.com/posts/import-export-excel-to-database-in-laravel
Note: load is removed in maatwebsite 3.0, So make sure you copy paste 2.1.3 from site then run composer update.
cheers!
@@karlgarcia3039 Hello, I have 2.1 maatwebsite/excel and 5.8 laravel but I still get this error
@@kingrichardguevara4969 follow the post. copy paste the maatwebsite in composer.json under require and run composer update in you cmd.
Foklow the blog step 3 carefully. It should work
I have a problem: Call to undefined method Maatwebsite\Excel\Excel::load()
Hi, Maatwebsite/Excel package is not more include import options, that library has been change, you can solve this issue changing the package version in your composer.json file, put this: "maatwebsite/excel": "~2.1.0" in the require section on composer.json, then go to console terminal and type this: composer update !!! sorry my english please, am from Colombia, i don´t know much English!
@Karthick V use "maatwebsite/excel": "2.1.30",
am having an error time out after 60 seconds my excel data have 10,000 records
Error
Call to undefined method Maatwebsite\Excel\Excel::load()
please help me
it is because the version of the excel package, don't use version 3, use version 2
Can anyone help me how to put validations in each column?
laravel 5.8 in not work
I got error Undefined index: customer_name
thanks, I had a lot of problems with the version 3.1, I suggest to use this instead
what version it is?
Can I implement this without using laravel framework?
it no work
uwuwuevue luwuvel
How about automate all in one click, dynamic data in just one click
undefine customer_name
i faced this error " Illegal string offset 'customer_name'
how can i solve this error please ???
You don't need both foreach just one, use this code or comment your second foreach.
I apologize for my english, I'm brazilian
foreach($data->toArray() as $key => $value)
{
// foreach($value as $row) {
$insert_data[] = array(
'CustomerName' => $row['customer_name'],
'Gender' => $row['gender'],
'Address' => $row['address'],
'City' => $row['city'],
'PostalCode' => $row['postal_code'],
'Country' => $row['country']
);
// }
}
@@leandrosalles4799 This procedure is correct:
ImportExcelController.php:
foreach($data->toArray() as $key => $value)
{
$insert_data[] = array(
'CustomerName' => $value['customer_name'],
'Gender' => $value['gender'],
'Address' => $value['address'],
'City' => $value['city'],
'PostalCode' => $value['postal_code'],
'Country' => $value['country']
);
}
what is the import_exel/import in form
sir can u help me? i get errors message "Call to undefined method Illuminate\Database\Query\Builder::table()", how to fix that??
Error
Call to undefined method Maatwebsite\Excel\Excel::create().. Any solution for this?
Can we also import excel containing Image path , if yes can you please guide me for the same. ?
Illegal string offset 'customer_name'
missing customer_name from table just fix in db to solve
Illegal string offset 'customer_name' Sir i m facing this problem please tell me
same here
need fix
how can you solve it ???
You don't need both foreach just one, use this code or comment your second foreach.
I apologize for my english, I'm brazilian
foreach($data->toArray() as $key => $value)
{
// foreach($value as $row) {
$insert_data[] = array(
'CustomerName' => $row['customer_name'],
'Gender' => $row['gender'],
'Address' => $row['address'],
'City' => $row['city'],
'PostalCode' => $row['postal_code'],
'Country' => $row['country']
);
// }
}
WHATEVER THIS CAN HELP: Maatwebsite/Excel package is not more include import options, that library has been change, you can solve this issue changing the package version in your composer.json file, put this: "maatwebsite/excel": "~2.1.0" in the require section on composer.json, then go to console terminal and type this: composer update !!! sorry my english please, am from Colombia, i don´t know much English!
its throw error undefine customer_name
You don't need both foreach just one, use this code or comment your second foreach.
I apologize for my english, I'm brazilian
foreach($data->toArray() as $key => $value)
{
// foreach($value as $row) {
$insert_data[] = array(
'CustomerName' => $row['customer_name'],
'Gender' => $row['gender'],
'Address' => $row['address'],
'City' => $row['city'],
'PostalCode' => $row['postal_code'],
'Country' => $row['country']
);
// }
}
Why I still get erorrs after use your code? It say, 'undefined variabel:row'.
I apologize for my english,
Really? You couldn't get a mic?
how do we sort the data from this whole excel data?
this msg :simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found ?
Many thanks for this explanation, and it's work for me. But I have a question. Can we do Update instead Create? I trying to figure this out because there are 'id' in my database but the key value (like price, qty, etc) is not yet set. My goal is how to make excel file that we send to server is update the database instead insert in. Anyone with the same question?
Well, for those who have the same issue, I found the answer already.
Here --> stackoverflow.com/questions/54304707/how-to-update-data-in-database-using-import-excel
how to import date data ?
Hello Sir, I got error " Call to undefined method Maatwebsite\Excel\Excel::load()". Could you please advice?
i have same issue!!! Have you fixed that??
same. and not sound from plugin owner
@@vasagan100 version of excel package, use version 2 instead of version 3
thanks you bro.
How to import in related tables (one to many for example)?