簡體   English   中英

Google表格API V4 - 在開頭添加標簽

[英]Google Sheets API V4 - Adding a tab to the beginning

我正在使用以下代碼向我的電子表格添加新標簽:

$newSheetTitie = date("m/d/Y");

$body = new Google_Service_Sheets_BatchUpdateSpreadsheetRequest(array(
   'requests' => array('addSheet' => array('properties' => array('title' => $newSheetTitie )))));

$result = $service->spreadsheets->batchUpdate($spreadsheet_id,$body);

這很好用,但目前有沒有辦法將新工作表添加到文件的開頭(將其添加到其他選項卡)?

謝謝

這個修改怎么樣? 如果要將新工作表添加到第一個選項卡,請使用index的屬性,如下所示。 第一個選項卡為0

修改后的腳本

從:
 $body = new Google_Service_Sheets_BatchUpdateSpreadsheetRequest(array('requests' => array('addSheet' => array('properties' => array('title' => $newSheetTitie ))))); 
至:
 $body = new Google_Service_Sheets_BatchUpdateSpreadsheetRequest(array('requests' => array('addSheet' => array('properties' => array('title' => $newSheetTitie, 'index' => 0))))); 

參考文獻:

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM