How to Load data from excel file then submit it in Laravel?

  ajax, jquery, laravel, php

I want my user to upload a product with an excel file to a fixed category. For this, I have to insert some input field values with the excel file’s value. My upload form HTML is :

<form action="">
    <input type="file" name="excel">
    <button id="">Load Excel File</button>
<form action="{{ route('') }}" method="POST" enctype="multipart/form-data">
    <input type="hidden" value="25">
    <label for="">Price</label>
    <input type="text" placeholder="Product Price">
            <td>{{ Name }}</td>
            <td>{{ Email }}</td>
            <td>{{ Phone }}</td>
                <a href="">Remove</a>
    <button type="submit">Submit</button>

Here the category_id will be the same for every product. Then the unit price will be given by the user.
Then select the excel file. Then click on the Load excel file button. It will read the data from an excel file and show it in the table. At the same time, it will match the table header and excel file header column. Here will show only the match header data. Then user can check the data. If wants user can remove data. Then submit button will insert a row for each table column into the database in the matched database column.

My question is:
How can I read an excel file and show the data on the table and remove data from the table? Is it possible with AJAX or something else?

Source: Laravel

Leave a Reply