Storing exports on disk

Exports can easily be stored on any filesystem that Laravel supports.

Default disk

public function storeSheet()
{
    // Store on default disk
    Simplesheet::store(new InvoicesExport(2018), 'invoices.xlsx');
}
1
2
3
4
5

Custom disks

public function storeSheet()
{
    // Store on a different disk (e.g. s3)
    Simplesheet::store(new InvoicesExport(2018), 'invoices.xlsx', 's3');

    // Store on a different disk with a defined writer type.
    Simplesheet::store(new InvoicesExport(2018), 'invoices.xlsx', 's3', Simplesheet::XLSX);
}
1
2
3
4
5
6
7
8

Disk options

If you want to pass some options to the disk, pass them to Simplesheet::store() as the fifth parameter.

public function storeSheet()
{
    Simplesheet::store(new InvoicesExport(2018), 'invoices.xlsx', 's3', null, [
        'visibility' => 'private',
    ]);
}
1
2
3
4
5
6

Laravel has a shortcut for private files:

public function storeSheet()
{
    Simplesheet::store(new InvoicesExport(2018), 'invoices.xlsx', 's3', null, 'private');
}
1
2
3
4