web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Unanswered

EXCEL

(0) ShareShare
ReportReport
Posted on by 2

Is there any action in POWER AUTOMATE DESKTOP so I can turn an excel file (xlsm) into a PDF?

I have the same question (0)
  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @fjmatosnog 

     

    You can use run powershell script to run the below script which converts excel to pdf 

     

     

    # Load the required assemblies
    Add-Type -Path "C:\Program Files\Microsoft Office\Office16\Excel.dll"
    Add-Type -Path "C:\Program Files\Microsoft Office\Office16\microsoft.office.interop.excel.dll"
    
    # Create a new Excel application object
    $excelApp = New-Object -ComObject Excel.Application
    $excelApp.Visible = $false
    
    # Open the Excel file
    $workbook = $excelApp.Workbooks.Open("C:\path\to\your\excel_file.xlsx")
    
    # Save the workbook as PDF
    $pdfPath = "C:\path\to\output\pdf_file.pdf"
    $workbook.ExportAsFixedFormat([Microsoft.Office.Interop.Excel.XlFixedFormatType]::xlTypePDF, $pdfPath)
    
    # Close the workbook and quit Excel
    $workbook.Close()
    $excelApp.Quit()
    
    # Release the COM objects
    [System.Runtime.Interopservices.Marshal]::ReleaseComObject($workbook) | Out-Null
    [System.Runtime.Interopservices.Marshal]::ReleaseComObject($excelApp) | Out-Null
    [System.GC]::Collect()
    [System.GC]::WaitForPendingFinalizers()
    
    Write-Host "Excel file converted to PDF successfully."

     

    Let me know whether this helps !

     

  • fjmatosnog Profile Picture
    2 on at

    Hi Nived, when I ran the first command I got an error message saying that the Excel.dll and microsoft.office.interop.excel.dll files don't exists at this path. The first part of the error is in Portuguese, but it's saying this. After that, the others commands also raises erros messages

    Add-Type : Não é possível associar o parâmetro 'Path' ao destino. Exceção ao definir "Path": "Não é possível localizar o
    caminho 'C:\Program Files\Microsoft Office\Office16\Excel.dll' porque ele não existe."
    No linha:1 caractere:16
    + Add-Type -Path "C:\Program Files\Microsoft Office\Office16\Excel.dll"
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     + CategoryInfo : WriteError: (:) [Add-Type], ParameterBindingException
     + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.PowerShell.Commands.AddTypeCommand

     

    Add-Type : Não é possível associar o parâmetro 'Path' ao destino. Exceção ao definir "Path": "Não é possível localizar o
    caminho 'C:\Program Files\Microsoft Office\Office16\microsoft.office.interop.excel.dll' porque ele não existe."
    No linha:1 caractere:16
    + ... -Type -Path "C:\Program Files\Microsoft Office\Office16\microsoft.off ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     + CategoryInfo : WriteError: (:) [Add-Type], ParameterBindingException
     + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.PowerShell.Commands.AddTypeCommand

      

  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @fjmatosnog 

     

    do you have excel installed on the machine on which you are trying to run the flow ?

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 957

#2
Valantis Profile Picture

Valantis 847

#3
Haque Profile Picture

Haque 609

Last 30 days Overall leaderboard