![](/img/trans.png)
[英]how to read any sheet with the sheet name containing 'mine' from multiple excel files in a folder using python? i am using xlrd
[英]How to read multiple excel sheet using python
我有一张 excel 表,里面有多个表。 我的问题是从 url 读取 excel 文件,然后转换并保存为 .pdf 格式。 现在我使用 pandas 和 matplotlib 来解决我的问题。 但现在我只能阅读第一页。 所以我的问题是如何阅读多张纸关于这方面的任何指示都会有所帮助。
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
url = "https://exceltesting.xlsx"
df = pd.read_excel(url)
# df = pd.read_excel(url, sheet_name=['Technologies','Schedule'])
fig, ax = plt.subplots(figsize=(12, 4))
ax.axis('tight')
ax.axis('off')
the_table = ax.table(cellText=df.values, colLabels=df.columns, loc='center')
pp = PdfPages("1.pdf")
pp.savefig(fig, bbox_inches='tight')
pp.close()
例如,尝试将df = pd.read_excel(url, sheet_name = 1)
用于第二张纸:)
然后,您可以对工作表进行 for 循环,以将它们生成为带有相应工作表的 pdf:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.