Laravel-excel: [QUESTION] How to store the XLS file on the cloud?

Created on 26 Jan 2017  路  1Comment  路  Source: Maatwebsite/Laravel-Excel

Laravel 5.3
Package 2.1.2

Guys is it possible chose the disk from Laravel Filesystem on the store method?

I would like to do something like:

Excel::create($filename, function($excel) use($leads) {
    $excel->sheet('export_leads', function($sheet) use($leads) {
        $sheet->loadView('tenants.exports.leads')
        ->with('leads', $leads);
    });
})->store('xls', 's3');

or even

$file = Excel::create($filename, function($excel) use($leads) {
    $excel->sheet('export_leads', function($sheet) use($leads) {
        $sheet->loadView('tenants.exports.leads')
        ->with('leads', $leads);
    });
})->export('xls');
\Storage::disk('s3')->put('export', $file, 'public');

Any ideas?

Most helpful comment

Filesystem is not supported out of the box. You might try the following:

$file = Excel::create($filename, function($excel) use($leads) {
    $excel->sheet('export_leads', function($sheet) use($leads) {
        $sheet->loadView('tenants.exports.leads')
        ->with('leads', $leads);
    });
})->string('xls');

\Storage::disk('s3')->put('export', $file, 'public');

string() returns the raw content.

>All comments

Filesystem is not supported out of the box. You might try the following:

$file = Excel::create($filename, function($excel) use($leads) {
    $excel->sheet('export_leads', function($sheet) use($leads) {
        $sheet->loadView('tenants.exports.leads')
        ->with('leads', $leads);
    });
})->string('xls');

\Storage::disk('s3')->put('export', $file, 'public');

string() returns the raw content.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thearabbit picture thearabbit  路  3Comments

vandolphreyes picture vandolphreyes  路  3Comments

octoxan picture octoxan  路  3Comments

contifico picture contifico  路  3Comments

disto picture disto  路  3Comments