I'm trying to make the code able to post in here

http://spreadsheets.google.com/embeddedform?formkey=dEtSUVAtQVAtUVN1WDFPU3BEbm9yNkE6MA

I've been successful in getting to read from the spreadsheet.

With this code if you're wondering:

import urllib
opener = urllib.FancyURLopener({})
f = opener.open("urlhere")
print f.read()

How to create a C/C++ console application which connects to MySQL database and inserts a new column of type varchar into a given table. Application should ask the user for table and new column name

um, 3 things wrong with your post..

1. Wrong category
2. Start your own thread
3. Say please!

Ok, well I'm one step closer in figuring this out. I'm able now to submit the form, but all submissions are blank. Here is the code I have:

url = ('http://spreadsheets.google.com/formResponse?formkey=dEtSUVAtQVAtUVN1WDFPU3BEbm9yNkE6MA&ifq')
        post = raw_input('New Post: \n\n')
        data = urllib.urlencode([('query',post)])
        req = urllib2.Request(url)
        fd = urllib2.urlopen(req, data)
        while 1:
            data = fd.read(1024)
            if not len(data):
                break
            os.system("cls")
            print ("Successfully Entered!")
            print ('')
            sys.stdout.write(post)
            time.sleep(1)
            os.system("cls")

Ok I figured it out.

post = raw_input('New Post: \n\n')
        params = {'entry.0.single':post}
        data = urllib.urlencode(params)
        request = urllib2.Request(url,data)
        response = urllib2.urlopen(request)
        page=response.read(200000)
        os.system("cls")
        print ("Successfully Entered into Database")
        print ('')
        time.sleep(1)
        os.system("cls")

But now..I have a problem. But not a python problem. Google docs does not automatically republish when theres new data. At least I don't know how. It only republishes when you make changes to the spreadsheet itself. Anybody know how to do it so it re-publishes on data?

K..all is good. Google republishes the data every 5 mins. That'll have to do for now I suppose

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.