0

We are trying to enable excel data extraction in a machine where MS office is not present. While doing that we are facing issues to enable the Import-Excel module in SPE. We are facing the below problems: ImportExcel module Installtion failure in SPE

The same issue occurred in Windows Powershell as well. But we executed the below commands to get rid of the issue in Windows Powershell.

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Then executed the below:

Install-Module -Name Import-Excel -Scope CurrentUser -Force

After that, able to install ImportExcel in Windows PowerShell script. But same commands got failed in Sitecore Powershell.

We are following the below article. But no luck.

https://powershell.one/tricks/parsing/excel

Anybody has come across this issue. Can you please help us to resolve this issue?

2
  • I found this article, please check if it can help you: 4sysops.com/archives/… Jul 27 at 1:42
  • 1
    Thanks Himmat. Commands are working fine in Windows Powershell. But not in SPE. that is the issue we are facing.
    – Thamizh
    Jul 27 at 3:20
1

I also faced the same issue, I solved like below.

Before seeing this there is typo in your package name its ImportExcel not Import-Excel. First check this.

Run below in Sitecore PowerShell

Below for execution policy and TLS enablement.

> Set-ExecutionPolicy Unrestricted -Scope CurrentUser
> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Run below in Windows PowerShell

I am switching to windows PowerShell due to no admin privilege's in modifying access in folder.(In my environment)

This is to save the module in your local folder.

> Set-ExecutionPolicy Unrestricted -Scope CurrentUser

>Register-PSRepository -Default // Run this if you are not register PS repository.It should be like this , in case you register enter image description here

> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
> Save-Module -Name ImportExcel -Path 'C:\Program Files\WindowsPowerShell\Modules\temp1'

Run below in Sitecore PowerShell

Now we will install the module in Sitecore PowerShell.

> Install-Module -Name ImportExcel -Scope CurrentUser -Force

See its finally installing successfully.

enter image description here

3
  • Thanks for the answer. Foloowed the same steps but end up with errors is Win.Powershell and SPE.
    – Thamizh
    Jul 28 at 19:43
  • Win.PS Error: WARNING: Unable to resolve package source'powershellgallery.com/api/v2'.PackageManagement\Save-Package : No match was found for the specified search criteria and module name 'ImportExcel'. SPE Error: PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'ImportExcel'. At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.1\PSModule.psm1:9683 char:34
    – Thamizh
    Jul 28 at 19:51
  • Did you enabled TLS in Windows-Powershell, [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 . Then try save command. I update answer.
    – Andi AR
    Jul 29 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.