Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

TheRicolaa10's avatar

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

0 likes
0 replies

Please or to participate in this conversation.