Currently, I am developing a web application that requires the user to be able to upload data directly to their own Google spreadsheet.
Initially, I attempted to utilize the Google APIs Client Library for JavaScript but found that it does not include support for the Spreadsheet API (https://developers.google.com/apis-explorer/#p/).
Subsequently, I opted to work with the Google Spreadsheets API version 3.0 directly. Using jQuery
and JSONP
, I successfully fetched the user's spreadsheets:
$.ajax({
url: 'https://spreadsheets.google.com/feeds/spreadsheets/private/full?alt=json-in-script&access_token=' + access_token,
dataType: 'JSONP',
success: function(data){
// use the retrieved spreadsheets
}
});
Following this approach, I also managed to retrieve the sheets within the chosen spreadsheet. However, when attempting to send data to the selected sheet using POST
, I encountered an issue due to the limitations of JSONP
. Additionally, it appears that the Google server does not support CORS
. The browser error message received is as follows:
XMLHttpRequest cannot load https://spreadsheets.google.com/feeds/... Origin ..mysite.. is not allowed by Access-Control-Allow-Origin.
Any insights or solutions you can provide would be greatly appreciated. Thank you for your assistance in resolving this matter.