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')
        });

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for your answer, then I dont waste my time on ajax :)
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. stackoverflow.com/questions/19887737/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.