Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

495
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda