olegv / sheets
Google sheets manager
v1.0.1
2025-03-08 11:07 UTC
Requires
- php: ^8.2
- ext-curl: *
- ext-openssl: *
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^11.0
This package is auto-updated.
Last update: 2025-04-18 12:42:51 UTC
README
Lib for work with google sheets
Features
- lightweight
- dependency-free(only curl and openssl)
- 90+% test coverage
- phpstan max lvl
- phpstan full strict rules
Install
composer require olegv/sheets
Usage
- You must create project and add to project
service account
here - In
service account
must createkey
in kes tab, after that your credentials will be downloaded as a json file - Put json file with credentials somewhere, for example
/path_to/credentials.json
- Ydoou may need to add the email address from your credentials to sheet access
- Code example
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);