Can Google App Engine read CSV file and show the content in the web page?

576 views
Skip to first unread message

DiveIntoGAE

unread,
Jun 4, 2009, 7:27:34 AM6/4/09
to Google App Engine
Can Google App Engine read CSV file and show the content in the web
page?

Can anybody give me a example?

Sylvain

unread,
Jun 4, 2009, 7:51:17 AM6/4/09
to Google App Engine
Something like that should work (didn't test it)

class MainPage(webapp.RequestHandler):
def get(self):
f = open('my_file.csv') # my_file.csv : same level than main.py
and not static
csv = f.read()
self.response.headers['Content-Type'] = 'text/csv'
self.response.out.write(csv)

application = webapp.WSGIApplication(
[('/', MainPage)],
debug=True)

Tim Hoffman

unread,
Jun 4, 2009, 7:55:45 AM6/4/09
to Google App Engine
Hi

python under app engine can read files, it just can't write files to
the file system under gae.

So have a look at the getting started guide - for instance the Hello
World or the Template examples
and just modify them to read the csv and output it.
Its a pretty basic addition if you have worked out how to do file i/o
in python.

I suggest you work through the exmples and get use to the platform.

Rgds

T
Reply all
Reply to author
Forward
0 new messages