0

I'm using Laravel 8 and I have uploaded Excel file into the server. The name of the file is "data.xlsx" and it's stored in /public/uploads. Inside the data.xlsx there are three columns with data.

In my database I have already created a table called "promos". Inside that table there are three columns: id, name, code.

How can I store the first and the second column data from the data.xlsx file into the "promos" table, specifically name and code column?

is it possible to achieve this without using additional libraries on Laravel?

2 Answers 2

1

If you dont want to use library for read excel data and save in database , then you can write it in normal php system with **IOFactory::createReader('Xlsx');

The easy solution is you can use https://github.com/Maatwebsite/ in laravel and their functionality is easy to understand and you can also customize storing the first and the second column data from the data.xlsx file

Sign up to request clarification or add additional context in comments.

Comments

1

You can use https://laravel-excel.com/ for easy upload excel data to DB

1 Comment

Thank you for your answer. Both of you are right and I had to choose marked answer with more details explained. +1 from me :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.