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

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 ... <etc.>

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.

 

 

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.

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

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.

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.

Thanks again Mr Fullenwarth, much appreciated.