En utilisant le code ci-dessous, je peux obtenir les données à imprimer. Comment changer de code pour xlrd?Connexion Excel avec Python
Comment modifier ce code pour utiliser un fichier xls déjà ouvert et visible. Ainsi, le fichier est ouvert d'abord manuellement, puis le script s'exécute.
Et, est mis à jour.
puis sont poussés dans Mysql
import os
from win32com.client import constants, Dispatch
import numpy as np
#----------------------------------------
# get data from excel file
#----------------------------------------
XLS_FILE = "C:\\xtest\\example.xls"
ROW_SPAN = (1, 16)
COL_SPAN = (1, 6)
app = Dispatch("Excel.Application")
app.Visible = True
ws = app.Workbooks.Open(XLS_FILE).Sheets(1)
xldata = [[ws.Cells(row, col).Value
for col in xrange(COL_SPAN[0], COL_SPAN[1])]
for row in xrange(ROW_SPAN[0], ROW_SPAN[1])]
#print xldata
a = np.asarray(list(xldata), dtype='object')
print a
Parce qu'il est génial: [pyspread] (http://pyspread.sourceforge.net/) – nmichaels