0

I have a template xls to which I write some data. This template needs to be saved in different folder under different name. Here is code I use:

        Excel::load('template.xls', function($excel) use($order) {
            // Writing stuff

        })->store('xls', public_path('exports'));

How do I change this code to write file under different name? I now it's trivial but I couldn't find it in documentation.

GeekDaddy
  • 619
  • 1
  • 10
  • 21

1 Answers1

1

Haven't tested it but try this:

Excel::load('template.xls', function($excel) use($order) {
        // Writing stuff

})->setFileName('new-filename')->store('xls', public_path('exports'));

Note that you shouldn't need to specify an file extension

lukasgeiter
  • 147,337
  • 26
  • 332
  • 270