Python et Excel

Python et Excel - Python - Programmation

Marsh Posté le 03-05-2004 à 16:14:34    

Bonjour,
 
J'aimerais lire un fichier excel (eh oui! chez moi openoffice n'est pas encore en vigueur! sic !) dans python.
 
quelqu'un sait-il comment faire ?
 
Merci d'avance

Reply

Marsh Posté le 03-05-2004 à 16:14:34   

Reply

Marsh Posté le 04-05-2004 à 22:44:10    

Tu exportes en CSV et tu sais parser ton fichier facilement: http://docs.python.org/lib/module-csv.html

Reply

Marsh Posté le 04-05-2004 à 22:46:52    

Si t'es sous windows et si t'as excel tu peux passer par l'interface pythoncom pour manipuler en python les objets COM d'excel.

Reply

Marsh Posté le 09-05-2004 à 19:48:36    

Bonjour,
finalement j'ai trouvé la solution suivante :
        nomfic = 'C:/fic.XLS'
        #xl = win32com.client.Dispatch("Excel.Application" )
        xl = win32com.client.Dispatch("Excel.Application" )
        wb = xl.Workbooks.Open(nomfic)
        sh = wb.Worksheets(1)
 
        for row in sh.UsedRange.value:
            zone0 = row[0]
            zone1 = row[1]
            etc,etc
 
Merci a tous
 

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed