PHP code example of zlt / laravel-google-sheet

1. Go to this page and download the library: Download zlt/laravel-google-sheet library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zlt / laravel-google-sheet example snippets


 'google' => [
            'clientId' => env('GOOGLE_DRIVE_CLIENT_ID'),
            'clientSecret' => env('GOOGLE_DRIVE_CLIENT_SECRET'),
            'refreshToken' => env('GOOGLE_DRIVE_REFRESH_TOKEN')
        ],

    $service = new Zlt\LaravelGoogleSheet\Services\GoogleSheetService();
    dd($service->get('sheetId'));
  
    // You can specify the range 
    dd($service->get('sheetId','A:G'))  
   

$service = new Zlt\LaravelGoogleSheet\Services\GoogleSheetService();
dd($service->getValuesBySheetName('sheetId','sheetName'));
 

$service = new Zlt\LaravelGoogleSheet\Services\GoogleSheetService();
dd($service->getSheetDetails('sheetId'));

$service = new Zlt\LaravelGoogleSheet\Services\GoogleSheetService();
dd($service->insertValues('sheetId','A:D',[[1,2,3,4],[a,b,c,d]]));

$service = new Zlt\LaravelGoogleSheet\Services\GoogleSheetService();

/** @var Google\Service\Sheets $sheetService */
$sheetService = $service->getServiceInstance();