Hab´s schon mit der Suchfunkt. probiert. Hier komme ich jedoch gar nicht weiter:
Ich möchte mit Python Zeilenweise in eine Exceldatei schreiben.
Hab ich zum Teil auch schon geschafft. Aber dass ganze soll so ablaufen: Jedesmal wenn das Programm neugestartet wird, sollen
die Daten (fang ich aus den Entry´s ab) in Excel in eine neue Zeile geschrieben werden.
Folgendes habe ich bishererreicht:
Code: Alles auswählen
import win32com
import win32com.client
from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")
xlApp.Workbooks.Open("C:\Dokumente und Einstellungen\Richy Rich\Desktop\Haftschnitt.xls")
xlApp.Visible = 1
xlApp.ActiveSheet.Cells(1,1).Value = 'VSNR'
xlApp.ActiveSheet.Cells(1,2).Value = 'Vorname'
xlApp.ActiveSheet.Cells(1,3).Value = 'Zuname'
xlApp.ActiveSheet.Cells(1,4).Value = 'Straße'
xlApp.ActiveSheet.Cells(1,5).Value = 'Hausnr'
xlApp.ActiveSheet.Cells(1,6).Value = 'PLZ'
xlApp.ActiveSheet.Cells(1,7).Value = 'Ort'
xlApp.ActiveSheet.Cells(1,8).Value = 'Beruf'
xlApp.ActiveSheet.Cells(1,9).Value = 'Branche'
xlApp.ActiveSheet.Cells(1,10).Value = 'Gebdat'
xlApp.ActiveSheet.Cells(1,11).Value = 'Staatsangeh'
xlApp.ActiveSheet.Cells(2,1).Value = vsnr
xlApp.ActiveSheet.Cells(2,2).Value = vorname
xlApp.ActiveSheet.Cells(2,3).Value = zuname
xlApp.ActiveSheet.Cells(2,4).Value = straße
xlApp.ActiveSheet.Cells(2,5).Value = hausnr
xlApp.ActiveSheet.Cells(2,6).Value = plz
xlApp.ActiveSheet.Cells(2,7).Value = ort
xlApp.ActiveSheet.Cells(2,8).Value = beruf
xlApp.ActiveSheet.Cells(2,9).Value = branche
xlApp.ActiveSheet.Cells(2,10).Value = gebdat
xlApp.ActiveSheet.Cells(2,11).Value = staatsan
xlApp.ActiveWorkbook.Close(SaveChanges=1)
xlApp.Quit()
xlApp.Visible = 0
del xlApp
Kennt einer`ne Lösung?
Gruss andy