EXCEL TO PDF

Hello, I quit new with Knime. My task was create excel (formatted reports) and some of them save as PDF file… I here starts my problem… I haven’t found out any node to save as pdf and keep original format… I try this python code, but it didn’t work… Could somebody help me with it. I don’t know where i make mistake and can’t find any logic…

from pandas import DataFrame
import win32com.client
o = win32com.client.Dispatch(“Excel.Application”)
o.Visible = False
wb_path = ‘‪C:/Users/api/Desktop/TSO.xlsx’
path_to_pdf = ‘‪C:/Users/api/Desktop/TSO.pdf’
wb = o.Workbooks.Open(wb_path)
ws_index_list = [1] #default_1
wb.WorkSheets(ws_index_list).Select()
wb.ActiveSheet.ExportAsFixedFormat(0, path_to_pdf)
wb.Close()
o.Quit()
output_table = DataFrame()

Hi @Apilipauskas and welcome to the forum.

Can you provide more detail about you mean you mean when you say “it didn’t work”? What kind of error messages do you receive? How are you using the Python code inside the KNIME workflow? What do your input data and intended output look like?

If you can provide an example workflow showing what you’ve tried so far, maybe someone will be able to help further.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.