Anyone know how to convert excel to pdf?

I wrote a arbitrary lib for generate report from excel template
https://github.com/Image-Py/xlreport

but now I want to convert the excel to pdf, anyone know esay way?

now I had find 2 way:

  1. on windows, we can use win32 api to operate ms excel
  2. https://www.convertapi.com/xlsx-to-pdf here is a web api.

but is there an offline python api to do this?

You might look at the Apache OpenOffice API (UNO) Python interface package:

I use UNO for Java to open LibreOffice and transfer selected values to R or export values. It’s quite powerful and works for Linux, MacOSX and Windows. I think it should be possible tp export Excel sheets to PDF, see here: