Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

490
Vistas
Export and save excel in a directory using maatwebsite

I am using maatwebsite (laravel) to write customer data into existing excel file and export dynamically from database and my code is working fine.

I am following below link:

maatwebsite

Now I want as excel file will download that should be save in any directory like /uploads/customers/text.xlsx

Edit: See my code:

try {
    Excel::selectSheetsByIndex(1)->load('/public/uploads/new.xlsx', function($reader) {
    $reader->sheet('sheetname',function($sheet)
    {  
      $sheet->appendRow('test','test', 'test');
    });
 }, 'UTF-8')->export('xlsx');
} catch (Exception $ex) {
    echo $ex->getMessage().$ex->getLine();
    return response(Helpers::makeDefaultErrorAjaxResponse());
}

How can I do that using the maatwebsite function, I am not getting any function for doing this?

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

In Laravel Excel (Maatwebsite Excel 3) you use store method on Excel facade (Maatwebsite\Excel\Facades\Excel):

Excel::store(new YourExport(), 'customers/fileName.xlsx', 'local');

The third parameter is a filesystem defined in config/filesystems.php (it's optional). If the location where you want to store those Excel files is outside the default local and public filesystems, you can add it to the config file:

'customer_uploads' => [
    'driver' => 'local',
    'root' => '/uploads/customers/',
],

And then save your Excel files with the thrid parameter set to that new filesystem:

Excel::store(new YourExport(), 'fileName.xlsx', 'customer_uploads');

Read more here: https://docs.laravel-excel.com/3.1/exports/store.html

about 4 years ago · Santiago Trujillo Denunciar

0

You can use ->save function to save the generated file to a folder on server. For more details look at https://laravel-excel.maatwebsite.nl/docs/2.1/export/store#docs

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda