Jan 11, 2017
0
Level 1
Laravel Excel macro's
Hello guys,
Last year I built a website with Laravel for a yearly event. Last year I imported a CSV file from Dropbox into my database. Last week I started to simpify it, to pick a sheet and convert it to an csv file and save it temporarily to my server. But it looks like Laravel-Exel can't handle macro's...
My code: // Set user agent for SSL ini_set('user_agent', "PHP\r\nX-MyCustomHeader: Foo");
// Get download link from Dropbox
$filename = '/excel.xls';
$adapter = Storage::disk('dropbox')->getAdapter();
$client = $adapter->getClient();
$host = $client->createTemporaryDirectLink($filename);
// CURL request to Dropbox
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $host[0]);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$result = curl_exec($ch);
curl_close($ch);
// Save file to the server
Storage::disk('local')->put('programma.xls', $result);
$excelFile = Storage::disk('local')->getDriver()->getAdapter()->getPathPrefix() . 'programma.xls';
\Excel::selectSheets('Uitslagen_Site')->load($excelFile, function($reader) {
})->store('csv', storage_path('app/'));
Is there a solution for this?
Thanks in advance
Please or to participate in this conversation.