PHP code example of basecardhero / spreadsheet

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

    

basecardhero / spreadsheet example snippets

 php
client = new \Google_Client(); // Make sure to configure your Google client.
$sheetService = new \Google_Service_Sheets($client);
$spreadsheet = new \BaseCardHero\Spreadsheet\Spreadsheet($sheetService);
 php
$spreadsheet->create()
    ->getSpreadsheet(); // \Google_Service_Sheets_Spreadsheet
 php
$spreadsheetId = '1b7c48b64ef1d5bf093632e7f8aa6529';

$spreadsheet->retrieve($spreadsheetId)
    ->getSpreadsheet(); // \Google_Service_Sheets_Spreadsheet
 php
$spreadsheet->create()
    ->setTitle('My Spreadsheet Title')
    ->getSpreadsheet(); // \Google_Service_Sheets_Spreadsheet
 php
$spreadsheet->create()
    ->clearRanges(['A1:A', 'B1:B'])
    ->getSpreadsheet(); // \Google_Service_Sheets_Spreadsheet
 php
$otherSpreadsheetId = '635d0d664ff92db666a9be5ed84f231c';
$otherSheetId = 0;

$spreadsheet->create()
    ->copySheetFrom($otherSpreadsheetId, $otherSheetId)
    ->getSpreadsheet(); // \Google_Service_Sheets_Spreadsheet
 php
$sheetId = 0;

$spreadsheet->create()
    ->deleteSheet($sheetId)
    ->getSpreadsheet(); // \Google_Service_Sheets_Spreadsheet