I am confused about the new Google Sheets API v4. My question is: how can I insert a row to the beginning of the spreadsheet?
I can't find any useful tutorial for the new Google Sheet API v4 or find viable documentation from Google specific to PHP.
I got this,
$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);
where $this->service is instance of Google_Service_Sheets and $this->sheetID is your SheetID from google docs url
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With