I am working on a project and want to write excel and csv files from python 3 on my windows server. Can anyone help if the goal could be achieved from python ? A HOW would be utterly appreciated.
Thanks for your help !
I am working on a project and want to write excel and csv files from python 3 on my windows server. Can anyone help if the goal could be achieved from python ? A HOW would be utterly appreciated.
Thanks for your help !
Python has a great built-in module called csv that will help you with the csv files. There are examples here, and the Python documentation is (as always) your first/close-to-best reference.
As for Excel, I wrote some wrappers for the xlrd and xlwt modules and posted them here: Python script to manipulate excel sheets by auto-filling spaces in columns The answer in that question contains examples of how to use the wrappers, and the wrappers themselves are examples of how to cal xlrd and xlwt. The wrappers I wrote assume square tables (possibly with nulls), one table per worksheet. Anything more exotic than that and you're on your own :)
Python has a built-in library called csv. This library can read csv files and convert them to python data structures, and vice versa. An example (from python documentation):
import csv
with open('eggs.csv', 'w', newline='') as csvfile:
spamwriter = csv.writer(csvfile, delimiter=' ',
quotechar='|', quoting=csv.QUOTE_MINIMAL)
spamwriter.writerow(['Spam'] * 5 + ['Baked Beans'])
spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])