thesogafoi's avatar

Nuxt Js , Laravel and handing Excel file Format

Hey Dudes , I have a Project that my front End created by nuxt js and My backend is laravel ,

so laravel and nuxt Are on separate servers , and i use laravel's api for get and send data from nuxt to laravel.

here i have problem :

think we have a post Model that contains title and description column . we want to upload an excel file that contain posts (for example 100 posts) and then existed data fill in database ( many rows existed in excel file that contain post title and post description) .

but how can i handle this . make 100 request from nuxt and send it to laravel or send excel file to backend then in there make 100 posts ?

0 likes
6 replies
Sinnbeck's avatar

Do you mean you can just upload it to the laravel server and import using artisan? If so, look into csv seeding perhaps. There are packages

thesogafoi's avatar

thank you for respond ,

not just upload in laravel server . upload it and import it to database

and i think i have two ways for do this :

  1. in nuxt js make requests As many as the number of posts in an Excel file and send them to laravel and get response for each of them

  2. send file to laravel (backend ) and create data for each rows that exists in excel file

i dunno which one is better

Sinnbeck's avatar

A now I get it. I would definitely use the second approach with the help of the laravel excel package by maatwebsite

thesogafoi's avatar

but what about error handling for example 20th row has error , or second row in excel has empty title

Please or to participate in this conversation.