Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88854

how to convert excel to pdf with python in linux?

$
0
0

I am trying to convert excel file to PDF with win32com but it not working on Linux ... can you help me to find library to do that in Linux

win32com work with me in windows but cannot be installed in Linux

i have to do this in Linux with python

import win32com.client

def pdf ():
    o = win32com.client.Dispatch("Excel.Application")
    o.Visible = False
    wb_path = r'c:\user\desktop\sample.xls'

    wb = o.Workbooks.Open(wb_path)

    ws_index_list = [1,4,5] #say you want to print these sheets

    path_to_pdf = r'C:\user\desktop\sample.pdf'

    wb.WorkSheets(ws_index_list).Select()

    wb.ActiveSheet.ExportAsFixedFormat(0, path_to_pdf)

Viewing all articles
Browse latest Browse all 88854


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>