Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 通过Python使用COM API阅读Excel工作表_Python 2.7 - Fatal编程技术网

Python 2.7 通过Python使用COM API阅读Excel工作表

Python 2.7 通过Python使用COM API阅读Excel工作表,python-2.7,Python 2.7,我在前面使用过xlrd和xlwt,它们易于读取行和列。我正在将当前的excel读写代码(当前正在使用xlrd和xlwt)转换为excel com api import win32com.client as win32 excel = win32.Dispatch('Excel.Application') wbtemp = excel.Workbooks.Open(file path) readtemp = wbtemp.Worksheets('Temp') read_1 = readtemp.C

我在前面使用过xlrd和xlwt,它们易于读取行和列。我正在将当前的excel读写代码(当前正在使用xlrd和xlwt)转换为excel com api

import win32com.client as win32
excel = win32.Dispatch('Excel.Application')
wbtemp = excel.Workbooks.Open(file path)
readtemp = wbtemp.Worksheets('Temp')
read_1 = readtemp.Cells(1,1)
print read_1
System User

used = readtemp.UsedRange
print used.Find('System User')
System User ## it shows System User is present in worksheet, wont give which cell

print used.Find('xyz')
None ## when its not found on worksheet
目前上述代码硬编码到单元格(1,1),但我正在寻找灵活的方法,如在工作表中搜索“系统用户”,并以单元格(1,1)的形式获得回复

import win32com.client as win32
excel = win32.Dispatch('Excel.Application')
wbtemp = excel.Workbooks.Open(file path)
readtemp = wbtemp.Worksheets('Temp')
read_1 = readtemp.Cells(1,1)
print read_1
System User

used = readtemp.UsedRange
a = used.Rows.Find('System User')
print a.Address
$A$1 ## Thats what I was looking for..