读取单元格excel win32com

2024-06-16 12:12:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我的问题是印刷时价格不动

我从excel得到的价格

enter image description here

enter image description here

我想读一个单元格,然后打印价格并不断变化

enter code here
from win32com import client as client
import time
excel = client.dynamic.Dispatch("Excel.Application")
excel.Visible= True
wz=excel.Workbooks.Add()
def m():
wp=wz.Worksheets.Add()
   wp.Name = "hihuih"
   time.sleep(10)
   return wp
x=m()
while True:
  p=x.Range("A1:A1").Value
  time.sleep(0.1)
print(p)

Tags: fromimportclientaddtrueheretimea1