2

How to post (or insert) data to google spreadsheet? I don't use form, but I have input fields. However, the data cannot be sent to my spreadsheet. If someone could help?

 <input id="name" type="text" />
 <input id="location" type="text" />

I'd like to use ajax to post entered data to google spreadsheet.

  $.ajax({
            type: 'post',
            url: 'https://docs.google.com/spreadsheet/ccc?key=8D84JF82FK23413',
            data: {
               name:  $('#name').val(),
               country: $('#location').val()
            },
            success: alert('PASS')
        });
olo
  • 5,225
  • 15
  • 52
  • 92

1 Answers1

4

I don't think it will be possible to insert a row just with an AJAX request. AJAX does not work across different domains.

There's a lot to learn, but you can start with the Google Speadsheet API...

https://developers.google.com/google-apps/spreadsheets

Trent
  • 1,280
  • 11
  • 12
  • Thank you for your answer, then I dont waste my time on ajax :) – olo Jan 09 '13 at 02:53
  • AJAX does work across domains when your JSON data is wrapped in a function (JSONP). Here is a way to push new data rows into a Google Sheet - it requires preparing your Sheet with Javascript that receives requests. http://stackoverflow.com/questions/19887737/pushing-data-to-google-spreadsheet-through-javascript-running-in-browser#37730306 – Dylan Valade Oct 25 '16 at 16:57