Export-Excel is not recognized in Powershell Core (6.1)

Welcome Forums General PowerShell Q&A Export-Excel is not recognized in Powershell Core (6.1)

This topic contains 5 replies, has 3 voices, and was last updated by

 
Participant
5 months, 1 week ago.

  • Author
    Posts
  • #138856

    Participant
    Topics: 73
    Replies: 119
    Points: 505
    Rank: Major Contributor

    I have been gradually migrating my old scripts in Windows PS ISE (5.1) to the VSCode/PS Core (6.1) environment.  The cmdlet Export-Excel, which works in PS ISE, is flagged an error in PS Core when I run my script:

    
    Export-Excel ... 
    
    The term 'Export-Excel' is not recognized as the name of a cmdlet, ...
    
    

    I have returned to Powershell ISE to run the script, but wonder if there is a known fix or update that would make Export-Excel work in PS Core.  Would be grateful for any tips or advice.

     

     

  • #138859

    Participant
    Topics: 1
    Replies: 1430
    Points: 2,127
    Helping Hand
    Rank: Community Hero

    Export-Excel is not a native cmdlet. You probably imported it from a certain module like ImportExcel. To use it in a PS Core (6.1) environment you have to import it there as well if possible.

  • #138862

    Participant
    Topics: 6
    Replies: 55
    Points: 356
    Helping Hand
    Rank: Contributor

    I don't know the module you are using but you can try to upgrade to the latest version.
    Sometimes there is a new version out which is compatible to PowerShell Core.

    Update-Module -Name ImportExcel
    • #138865

      Participant
      Topics: 73
      Replies: 119
      Points: 505
      Rank: Major Contributor

      Many thanks, Mr Fullenwarth.  I tried it and got an error message – but it led me to realize that I had to install the whole thing in PS Core (6.1).  Which I did, using:

      Install-Module -Name ImportExcel -RequiredVersion 5.0.1

      Everything worked after that.  Once again, my sincerest thanks for your guidance.

  • #138873

    Participant
    Topics: 6
    Replies: 55
    Points: 356
    Helping Hand
    Rank: Contributor

    Great!
    In addition, for modules which have not been natively written for or adapted to PowerShell Core, you can use the WindowsCompatibility module.

    Install-Module -Name WindowsCompatibility

    And then, every time you want to use a legacy module in PowerShell Core

    Import-WinModule -Name ImportExcel

    It doesn't work with every module but it's worth trying.

    • #138882

      Participant
      Topics: 73
      Replies: 119
      Points: 505
      Rank: Major Contributor

      Thanks again Mr Fullenwarth, much appreciated.

The topic ‘Export-Excel is not recognized in Powershell Core (6.1)’ is closed to new replies.