PHP code example of elsevar / google-sheets
1. Go to this page and download the library: Download elsevar/google-sheets 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/ */
elsevar / google-sheets example snippets
use Elsevar\GoogleSheets\Services\GoogleSheetsService;
use Elsevar\GoogleSheets\Models\GoogleToken;
$service = new GoogleSheetsService();
$token = GoogleToken::where('user_id', auth()->id())->first();
if ($token) {
$service->setToken($token);
// Read data
$data = $service->readSheet('spreadsheet-id', 'Sheet1!A1:B10');
// Write data
$service->writeSheet('spreadsheet-id', 'Sheet1!A1', [['Name', 'Email']]);
}
bash
php artisan migrate
bash
php artisan vendor:publish --tag=google-sheets-config