I am working on google spreadsheet and want to update data that I want. I read this article and update the data successful on its console. Now I want to update data with PHP curl
and I am a little bit confuse for these options
valueInputOption=USER_ENTERED
"majorDimension": "COLUMNS"
When I entered my desired values in above Article console editor its update data successfully and give me following results
Request
PUT https://sheets.googleapis.com/v4/spreadsheets/**************F9NM/values/A4:G4?valueInputOption=USER_ENTERED&key={YOUR_API_KEY}
{
"majorDimension": "COLUMNS",
"values": [
[
"myemail@mail.com"
],
[
"First Name"
],
[
"Last Name"
],
[
"Mobile"
],
[
"URL"
],
[
"US"
],
[
"54654654654"
]
]
}
Response
Cache-Control: private
Content-Encoding: gzip
Content-Length: 143
Content-Type: application/json; charset=UTF-8
Date: Sat, 08 Oct 2016 09:34:11 GMT
Server: ESF
Vary: Origin, X-Origin, Referer
{
"spreadsheetId": "******************F9NM",
"updatedRange": "Sheet1!A4:G4",
"updatedRows": 1,
"updatedColumns": 7,
"updatedCells": 7
}
So my confusion is that how can i put my values (that I want to update) in this USER_ENTERED
and how can I set majorDimension": "COLUMNS
in php curl api link.
I searched a lot and read many articles about Update google api spreadsheet
but I get nothing helpful or use full
Here is my code that I want to try in php file:
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,"https://sheets.googleapis.com/v4/spreadsheets/*********F9NM/values/A4:G4?valueInputOption=USER_ENTERED&key=******************38");
//curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
$result = curl_exec ($curl);
curl_close ($curl);