PHP code example of olegv / sheets

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

    

olegv / sheets example snippets


use OlegV\Sheet;

$sheet = new Sheet("sheets_id",'/path_to/credentials.json');


//append
$response = ->setSheet('Sheet9')->append([[1,2,"Text","Текст","many words many words many words",6,7,8,9]], 'R1C1');
print_r($response);


//clear
$data = json_decode($response, true);
$range = explode('!', $data['updates']['updatedRange']);
$response = $sheet->clear($range[1]);
print_r($response);


//get
$response = $sheet->get(
    'A6:C6',
);
print_r($response);

//update
$response = $sheet->update(
    [[1, 2, 3]],
    'A6:C6',
);
print_r($response);