Google Sheets API 4:如何追加到行尾

2022-04-12 00:00:00 google-sheets-api php

能够通过提供范围更新行,代码如下:

$range = "A1:B1";
$valueRange= new Google_Service_Sheets_ValueRange();
$valueRange->setValues(["values" => ["a", "b"]]); 
$conf = ["valueInputOption" => "RAW"];
$service->spreadsheets_values->update($spreadsheetId, $range, $valueRange, $conf);

考虑到我不知道范围,如何将行插入到工作表的末尾。


解决方案

您是否在寻找spreadsheets.values.append?示例用法指南为here。

append的参考文档描述为:Appends values to a spreadsheet. The input range is used to search for existing data and find a "table" within that range. Values will be appended to the next row of the table, starting with the first column of the table. See the guide and sample code for specific details of how tables are detected and data is appended.

如果这不是您要找的,您能更具体地回答您的问题吗?

相关文章