Tom*_*sek 4 php google-spreadsheet-api google-api-php-client
我对新的Google表格API v4感到困惑.我的问题是:如何在电子表格的开头插入一行?
我找不到任何有用的新Google Sheet API v4教程,也没有找到特定于PHP的Google可行文档.
我懂了,
$requests = new Google_Service_Sheets_Request(array(
'insertDimension' => array(
'range' => array(
'sheetId' => 0,
'dimension' => "ROWS",
'startIndex' => 1,
'endIndex' => 2
)
)
));
$batchUpdateRequest = new Google_Service_Sheets_BatchUpdateSpreadsheetRequest(array(
'requests' => $requests
));
$this->service->spreadsheets->batchUpdate($this->sheetID, $batchUpdateRequest);
Run Code Online (Sandbox Code Playgroud)
其中$ this-> service是Google_Service_Sheets的实例,$ this-> sheetID是来自google docs url的SheetID