Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'd like to allow a user to visit one of my sites, enter some information into a field, and then save that information into a Google Spreadsheet via JavaScript.

  • I don't want the user to login via Google or have to do any special authentication.
  • It's Ok if the spreadsheet needs to be open to public; the data's not sensitive.
  • I don't want to use a Google Form, I want to have full control over the client-side UI.

I've been reading through the Google developer docs, but they only make mention to an OAuth login solution. The Google Developer Console allows you to create a "Public API access key", but does not explain how it's used.

share|improve this question
    
The current answer is good but if you haven't done something similar before it can de daunting. Instead look at building a webapp with apps script published to run as you. It will take care of all the authentication and so forth. –  Zig Mandel Apr 1 at 13:32

1 Answer 1

All of the examples are for the scenario where the user is using your app to access his own files. In your case, you want the app to access your own file. This isn't easy. The only ways I can see are :-

  1. Use a server app (appengine works well) to do the access
  2. Very carefully set up permissions and store a refresh token in your app.

Option 2 could be your worst security nightmare if you don't do it carefully, and even then may be an infringement of Google T's and C's since it's akin to distributing your password.

Once you figure out the auth, you'll need to check out the spreadsheet API (https://developers.google.com/google-apps/spreadsheets/), as this is the API that allows you to update an existing spreadsheet. The Drive API can only upload an entire new spreadsheet.

share|improve this answer
    
In the Spread Sheet API it is available for Java and .NET ,nothing is specified for java script.Can you please tell me how to add using Javascript –  nitesh Apr 9 at 5:22
    
the spreadsheet API is an HTTP REST API that is usable anywhere you can compose an HTTP Post. So in the simplest case new XmlHttpRequest().open('POST', url_from_documentation etc –  pinoyyid Apr 9 at 9:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.