Ugh. I'm pulling my hair out on this one. I am using JavaScript and Ajax to
work with Google Spreadsheets. I am able to create a spreadsheet and a
worksheet but I get an error when I try to add a row. The error I get is
"We're sorry, a server error occurred. Please wait a bit and try
reloading your spreadsheet." I've searched the forum for this but the only
answers I have found were not successful for me.
I retrieved the POST URL from the Lists feed and am using it in the
following request to add a row:
var ajaxRequest = new
Ajax.Request(https://spreadsheets.google.com/feeds/list/*key*/*worksheetId*
/private/full,
{
method: "POST",
contentType: "application/atom+xml",
postBody: "<entry xmlns=\"http://www.w3.org/2005/Atom\"
xmlns:gsx=\"http://schemas.google.com/spreadsheets/2006/extended\"><gsx:cellar-id>1</gsx:cellar-id><gsx:name>My
Cellar</gsx:name></entry>",
requestHeaders: [ "GData-Version", GoogleVersion, "Authorization",
GoogleSpreadsheetsAuthKey ],
onSuccess: this.addRow.bind(this, success),
onFailure: this.ajaxFailure.bind(this)
}
);
GoogleVersion is a global variable and is set to "3.0".
GoogleSpreadsheetsAuthKey also is a global variable and I am setting it when
I log the user in to Google; I know the value for GoogleSpreadsheetsAuthKey
is valid because I am successfully creating the spreadsheet and worksheet
right before I try to add the row.
Any ideas? I have been racking my brain and trying many things for hours. I
am at my wits end.
Thank you,
Scott