First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
I am doing like this:
from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")
def XLSReadValue(xbook,xsheet,cell,x,y): #x,y - offset from cell
value = xlApp.Workbooks(xbook).Sheets(xsheet).Range(cell).Offset(x+1,y+1).Value
return value
def XLSWriteValue(xbook,xsheet,cell,x,y,value): #x,y - offset from cell
xlApp.Workbooks(xbook).Sheets(xsheet).Range(cell).Offset(x+1,y+1).Value=value
Than, if I want to get from excel value from cell A1:
n=XLSReadValue('book.xls','sheet1','A1',0,0)