我正在尝试使用 google sheet API 来编写 google sheet API。
为此,我使用下面的代码
$spreadsheetId = 'XXXX';
$range = "Zoho Emails 2";
$values = [["This","is","a","new","row"],];
$body = new Google_Service_Sheets_ValueRange([
"values" =>$values
]);
$params = [
`valueInputOptions` => "RAW"
];
$insert = [
"insertDataOption" => "INSERT_ROWS"
];
$result = $service->spreadsheets_values->append(
$spreadsheetId,
$range,
$body,
$params,
$insert
);
但是当我运行这段代码时,这段代码给了我以下错误
[26-Nov-2019 22:45:36 America/Chicago] PHP Fatal error: Uncaught exception 'Google_Exception'
with message '(append) unknown parameter: ''' in
/Google_sheet/vendor/google/apiclient/src/Google/Service/Resource.php:147
Stack trace:
#0 /Google_sheet/vendor/google/apiclient-
services/src/Google/Service/Sheets/Resource/SpreadsheetsValues.php(65):
Google_Service_Resource->call('append', Array, 'Google_Service_...')
#1 /Google_sheet/quickstart.php(99): Google_Service_Sheets_Resource_SpreadsheetsValues-
>append('1k8sR-aV8O5W7jP...', 'Zoho Emails 2', Object(Google_Service_Sheets_ValueRange), Array,
Array)
#2 {main}
thrown in /Google_sheet/vendor/google/apiclient/src/Google/Service/Resource.php on line 147
但我不明白为什么会发生这个错误。
有人可以帮我吗?
当年话下