0
$FilePath = "D:\path\book1.xlsx"
$SheetName = "Sheet1" 
$objExcel = New-Object -ComObject "Excel.Application"
$WorkBook = $objExcel.Workbooks.Open($FilePath)

I am using Powershell 5 to read an Excel file, Office 365 based Excel is installed on my windows 10 machine.

The first statement itself fails. What should I look to fix it?

1
  • Please edit your post and include the error message, this will tell us what the issue is :) Commented Jan 8, 2019 at 14:50

1 Answer 1

1

Possibly you have a 64-bit Powershell session trying to access a 32-bit COM object.

To check this, try running a 32-bit Powershell (C:\Windows\SysWOW64\WindowsPowerShell)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.