I am working on a web application where I would like to allow the user to enter data into my Google spreadsheet.
First, I tried using the Google APIs API Client Library for JavaScript , but it doesn't seem to cover the Spreadsheet API ( https://developers.google.com/apis-explorer/#p/ ).
Then I decided to use the Google Spreadsheets API version 3.0 directly. I manage to get user tables using jQuery and JSONP :
$.ajax({ url: 'https://spreadsheets.google.com/feeds/spreadsheets/private/full?alt=json-in-script&access_token=' + access_token, dataType: 'JSONP', success: function(data){
In the same method, I retrieve sheets from a user-selected table. Then I have to POST pass the data to the selected sheet. And here the problem arises: cannot do this using JSONP . And the Google server does not seem to support CORS . I get the following error in the browser:
XMLHttpRequest cannot load https://spreadsheets.google.com/feeds/... Origin ..mysite.. is not allowed by Access-Control-Allow-Origin.
Thanks for looking at this.
javascript jsonp cors google-spreadsheet google-spreadsheet-api
Martin Dimitrov
source share