Created
December 31, 2019 09:26
-
-
Save victory-sokolov/97968c9962bd555e4c2a33e1b363fd33 to your computer and use it in GitHub Desktop.
Converts xlsx,csv to PDF file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note Microsoft Excel must be installed | |
from openpyxl import Workbook, load_workbook | |
from win32com.client import Dispatch | |
path = os.path.dirname(os.path.abspath(__file__)) | |
o = Dispatch("Excel.Application") | |
o.Visible = False | |
o.DisplayAlerts = False | |
wb = o.Workbooks.Open(path+"\\file.xlsx") | |
wb.WorkSheets("uzskaites lapa").Select() | |
wb.ActiveSheet.ExportAsFixedFormat(0, path+"\\test.pdf") | |
o.Quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment