Save only one Excel sheet as pdf with "Save Excel File as pdf"


I started to use UI Path and I want to print one selected Excel sheet as a pdf. My web search unfortunately has not helped me, because the field to select the sheet is missing in the latest version I am using. Any idea how I only can print only 1 selected sheet with “Save Excel File as pdf”?

Thanks a lot in advance


check the thread


How about copy the workbook to other name then remove unnecessary sheets in it as the following?


Hallo, a good idea to delete the not needed sheet, but I want to print diagrams. I think they will not work if I delete the sheets with the data before printing. Unfortunately, everything is connected and I even cannot select the page, because it changes depending on the amount of data in the tables.


All right. Can you try the following? This hides unnecessary sheets instead of removing and it will work as you expect.

Using wb As New ClosedXML.Excel.XLWorkbook(filename)
Dim sheets As ClosedXML.Excel.IXLWorksheets = wb.Worksheets
For Each  s  In sheets
If s.Name<>targetSheet Then
End If
End Using


thanks a lot for your proposal. However, I found an easier solution: Invoke VBA. The VBA code is a two line code:

  1. select sheet
  2. save as

(you can generate your code in excel very easy by using record a macro)

Read Range that sheet into a datatable. Write Range that sheet to a new Excel file so it only has that sheet. Then Save Excel File as PDF.