I try to read and write a cell in google spreadsheet with http request by 
javascript. The "read" operation works, but the "write" operation fail. 
Please help to point out which part I should modify in my code of "write" 
operation.

The write example I followed is from here 
https://developers.google.com/google-apps/spreadsheets/, and it is not 
working.

My read operation (this is working):

http_request.onreadystatechange = function() {
    process_cellrw(http_request);};
http_request.open('GET',"https://spreadsheets.google.com/feeds/cells/0Aqed....RHdGc/od6/private/full/R1C1";,
 true);
http_request.setRequestHeader('Authorization','Bearer ' + strAccessToken);
http_request.send(null);

My write operation (this is not working):

var testxml =  ['&lt;entry xmlns="http://www.w3.org/2005/Atom"; <br>
    xmlns:gs="http://schemas.google.com/spreadsheets/2006"&gt;',<br>
    
'&lt;id>https://spreadsheets.google.com/feeds/cells/0Aqed....RHdGc/od6/private/full/R1C1&lt;/id&gt;',<br>
    '&lt;link rel="edit" type="application/atom+xml"<br> 
href="https://spreadsheets.google.com/feeds/cells/0Aqed....RHdGc/od6/private/full/R1C2/9zlgi"/&gt;',<br>
    '&lt;gs:cell row="1" col="1" inputValue="xxxx"/&gt;',<br>
    '&lt;/entry&gt;'].join('');<br>

http_request.onreadystatechange = function() {
    process_cellrw();};

http_request.open('PUT',"https://spreadsheets.google.com/feeds/cells/0Aqed....RHdGc/od6/private/full/R1C2/9zlgi";);
http_request.setRequestHeader('Authorization','Bearer ' + strAccessToken);
http_request.setRequestHeader('GData-Version','3.0');
http_request.setRequestHeader('Content-Type', 'application/atom+xml');
http_request.setRequestHeader('If-Match','*');
http_request.setRequestHeader('Content-Length', testxml.length.toString());
http_request.send(testxml);

The write operation always receive http_request.status = 0 at callback 
functionprocess_cellrw().

My environment is Windows 7 + Chrome browser. I also tested it on Android + 
Webkit, still fails.

I also tested to add a row by list feed, also fails by receive 
http_request.status 
= 0.

Reply via email to