2023年10月13日 星期五
获取总行数 总列数
with xw.App(visible=False) as app:
# 选择要读取数据的工作表
wb = app.books.open(excel_path, update_links=False)
ws = wb.sheets[0]
column_count = ws.used_range.shape[1]
row_count = ws.used_range.shape[0]
print('column_count', column_count)
print('row_count', row_count)
# 修改 excel 数据
with xw.App() as app:
# 选择要读取数据的工作表
wb = app.books.open(excel_path, update_links=False)
import xlwings as xw
app = xw.App(add_book=False)
app.display_alerts = False
wb = app.books.api.Open(fullpath, UpdateLinks=False)
参考
https://stackoverflow.com/questions/56582161/how-to-suppress-update-links-alert-with-xlwings