PHP code example of ibnuhalimm / laravel-google-sheet

1. Go to this page and download the library: Download ibnuhalimm/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/ */

    

ibnuhalimm / laravel-google-sheet example snippets


use GoogleSheet;

$spreadSheetId = '1cyUalLbuw_TpAIgkf76JcU-BbsYCSwtVqJuf_gCNzYA';
$sheetName = 'Class Data';
$cellRange = 'A1:E5';

GoogleSheet::useDocument($spreadSheetId)->fetchData($sheetName, $cellRange);

=> [
     [
       "Student Name",
       "Gender",
       "Class Level",
       "Home State",
       "Major",
     ],
     [
       "Alexandra",
       "Female",
       "4. Senior",
       "CA",
       "English",
     ],
    ...
bash
php artisan vendor:publish --provider="Ibnuhalimm\LaravelGoogleSheet\GoogleSheetServiceProvider"
bash
php artisan vendor:publish --tag=google-sheet-config