I used to create spreadsheets in the following way:
wbk = xlwt . Taskbar () Earnings_tab = wbk.add_sheet ('Earnings') wbk.save (filepath) There is no way to save the file in the file path, and instead of writing it to the file What is the best way for a downloading user? Or do I need to save it as a TMP file and then the user has to serve it?
quote:
This is a stream object with a writing method Also, as in StringIO , Excel data is written in the data stream Modified example:
< Code> import StringIO f = StringIO.StringIO () # Create an object like a file wbk = xlwt.Workbook () earnings_tab = wbk .add_sheet ('Earnings') wbk.save (f) # write stdout Some suggestions might be given that StringIO instead of cStringIO , but in the former Please note that cStringIO when I last checked that Unicode is not properly handled It is also worth noting that StringIO has been changed to io in Python 3.
No comments:
Post a Comment