Tomas Lysek Tomas Lysek - 3 months ago 160x
PHP Question

Google spreadsheet api v4 with php - insert empty row to beging

i am confused from new google sheets api v4.
My question is, how should i insert row to beggining of the spreadsheet?

i can't find any usefull tutorial to new google sheet api v4 or find viable documentation from google specific to php, does anyone has it?


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