reverse / g-sheets
此包已被弃用且不再维护。未建议替代包。
Google Sheets 客户端库
v0.0.3-alpha
2019-04-08 12:26 UTC
Requires
- php: ^5.6 || ^7.0
- google/apiclient: 2.*
Requires (Dev)
- phpunit/phpunit: ^5.7.9
This package is auto-updated.
Last update: 2021-09-27 11:08:17 UTC
README
此包已过时,将很快被移除。我们建议直接使用 google/apiclient。
reverse/g-sheets
Google Sheets 的 PHP 客户端。
此库提供了一组类和方法,用于与 PHP 的 Google Api Client google/apiclient 一起工作。
要求
- php >= 5.6
安装
composer require reverse/g-sheets:"dev-master"
使用 GSheets
要操作 Google Sheets,需要初始化 Client
和 Spreadsheets
类。
$googleClient = new \Google_Client($config); $client = new Client($googleClient); spreadsheets = new Spreadsheets($client, 'sheetid');
操作
追加
$value = new Value('a', 'b', 'c'); $spreadsheets->append($value, 'Sheet1');
更新
$value = new Value('a', 'b', 'c'); $spreadsheets->update($value, 'Sheet1');
清除
$spreadsheets->clear('Sheet1!1:2');
获取
// This get return Sheet1's first column $spreadsheets->get('Sheet1!1:1');
删除
// This call delete first row of sheets specified // sheetId is gid not sheet's name $delete->execute(Delete::DIMENSION_ROWS, '12675hakas', 0, 1);