By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,222 Members | 2,374 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,222 IT Pros & Developers. It's quick & easy.


P: n/a
I write my code :
#inizializzazioni varie che tralascio
#mi connetto al mio db mysql e recupero i dati che volgio inserire
nel file excel
conn = MySQLdb.connect(host = "XXX", port = XXX, user = "XXX",
passwd = "XXX", db= "XXX")
cursor = conn.cursor()
cursor.execute("SELECT * FROM XXX")
allFields = cursor.description
allRecords = cursor.fetchall()
#inizializzo gli strumenti per lavorare in python con excel
xlApp = Dispatch("Excel.Application")
#xlApp.Visible = 1
#specifico che file utilizzare
xlbook = xlApp.Workbooks.Open('C:/view.xls')
i = 1
j = 1
#popolo il mio file excel
for field in allFields :
xlApp.ActiveSheet.Cells(i, j).Value = field[0]
j = j + 1
for records in allRecords :
i = i + 1
j = 1
for item in records :
xlApp.ActiveSheet.Cells(i, j).Value = item
j = j + 1
#salvo le modifiche effettuate
#scrivo le istruzioni che mi permettereanno di aprirlo in una
pagina html
size = os.path.getsize('C:/view.xls')
of = open("C:/view.xls","rb")
content =
print"Content-length:%d \r\n"%size
print content

I want open an excel document in an apache page.
I want write in excel document the information of a database mySQL and
after open the excel documen in a broswer page
Where is the problem?
Sorry for my english but I'm not speak english very well, I write in
this group because I think that in this forum there are very very good

Nov 14 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.