i managed update single cell, , trying update multiple cells in batch it's not working. please tell me what's wrong in code. code using:
$feed = "<feed xmlns='http://www.w3.org/2005/atom' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:gs='http://schemas.google.com/spreadsheets/2006'>\n"; $feed .= "<id>https://spreadsheets.google.com/feeds/cells/$gid/$worksheetid/private/full</id>\n"; foreach($postdata $post) { $row = $post["row"]; $col = $post["col"]; $data = $post["data"]; $rc = "r$row" . "c$col"; $requesturl = "https://spreadsheets.google.com/feeds/cells/$gid/$worksheetid/private/full/batch"; $url = "https://spreadsheets.google.com/feeds/cells/$gid/$worksheetid/private/full/$rc"; $feed .= "<entry>\n"; $feed .= "<batch:id>a$row</batch:id>\n"; $feed .= "<batch:operation type = 'update'/>\n"; $feed .= "<id>$url</id>\n"; $feed .= "<link rel='edit' type='application/atom+xml' href=$url />\n"; $feed .= "<gs:cell row=$row col=$col inputvalue='newdata' />\n"; $feed .= "</entry>\n"; } $feed .= "</feed>"; $curl = curl_init(); curl_setopt($curl, curlopt_url, $requesturl); curl_setopt($curl, curlopt_postfields, $feed); curl_setopt($curl, curlopt_header, false); $headers = array( "authorization: bearer " . $this->accesstokenarray->access_token, "gdata-version: 3.0", "content-type: application/atom+xml", "if-match: *", ); curl_setopt($curl, curlopt_httpheader, $headers); curl_setopt($curl, curlopt_ssl_verifypeer, false); curl_setopt($curl, curlopt_returntransfer, 1); curl_setopt($curl, curlopt_verbose, true); $httpcode = curl_getinfo($curl, curlinfo_http_code); return curl_exec($curl); and output getting:
<?xml version='1.0' encoding='utf-8'?> <feed xmlns='http://www.w3.org/2005/atom' xmlns:opensearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:gs='http://schemas.google.com/spreadsheets/2006'> <id>https://spreadsheets.google.com/feeds/cells/1/13ibclqo0zuddxrphekpeske6fkcxwdtpqlqxok_jwxg/batch/1437040636408</id> <updated>2015-07-16t09:57:16.413z</updated> <title>batch feed</title> <entry> <id>https://spreadsheets.google.com/feeds/cells/1/13ibclqo0zuddxrphekpeske6fkcxwdtpqlqxok_jwxg/batch/1437040636408/fatal</id> <updated>2015-07-16t09:57:16.413z</updated> <title>fatal error</title> <content>feed processing interrupted.</content> <batch:interrupted reason='[line 3, column 8, element feed] spreadsheet @ url not found. make sure have right url , owner of spreadsheet hasn't deleted it.' parsed='0' success='0' error='0' unprocessed='0'/> </entry> </feed>
tried swapping values of key , worksheetid in urls batch update call including urls in xml feed , worked.
Comments
Post a Comment