[英]How to convert an excel sheet to a pdf using python?
我有一個要轉換為 Python 的 excel 表。 需要為上述查詢建議包或模塊的建議。
我嘗試過使用 PDFWriter。 我正在使用 Pandas 讀取我的 excel 文件並將該數據集輸入到 PDFwriter 以創建 pdf 文件。 輸出 pdf 似乎是空白的。
import pandas as pd
from pdfrw import PdfWriter
wb = pd.read_excel('excel file path')
wb=PdfWriter()
wb.write('result.pdf')
僅以 1kb 創建的 pdf 文件..
這里有幾點:
你也可以試試這個鏈接。
import pandas as pd
import pdfkit
df = pd.read_excel("file.xlsx")#input
df.to_html("file.html")#to html
pdfkit.from_file("file.html", "file.pdf")#to pdf
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.