How to export a specific Excel sheet to PDF
💡 Do you need to export a specific Excel sheet to PDF, regardless whether the Excel file is open or closed?
Problem Description
There are no actions available for exporting a specific Excel sheet to PDF in Power Automate Desktop.
Solution
The following flow provides a high level overview of the solution:
Set the Excel file path for the variable “%ExcelFilePath%”
Get the file name of the Excel file path using “Get File Path Part” action
Under Variables produced, enable “The name of the source file” and change the variable to “%InputFileName%”
Set the name of the sheet you want to export in a variable and the PDF file path
Export Excel sheet
While Excel is closed
Add “Run VBScript” action
Under Variable produced, enable “VBscriptOutput” and “ScriptError”
Open the action and enter the code below:
Click Save
While Excel is Open
Add “Launch Excel” action, set the Document Path as “%ExcelFilePath%” and enable “Make instance visible”
Add “Run VBScript” action
Under Variable produced, enable “VBscriptOutput” and “ScriptError”
Open the action and enter the code below:
Add “Close Excel” action
The final output:
While Excel is closed
While Excel is open
Additional Information
Last updated on: 5 Dec 2024
Tested version(s): 2.50.00183.24303
Prerequisites: Excel
Dependencies: None
Known issues: None
References
Nil