首页 > 解决方案 > 打开应用程序时使用 Python 打开特定的 Excel 工作表

问题描述

使用 python 命令打开应用程序时,有没有办法指定在 excel 工作簿中打开哪个工作表?(例如:使用 win32 Dispatch 或 os.system)?

标签: pythonexcelpython-3.x

解决方案


我发现与熊猫相处最简单的方法:

import pandas as pd

df = pd.read_excel('path/to/sheet.xlsx', 'sheet_name')

您可以在此处阅读文档:https ://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html


推荐阅读