.net - How to open excel workbook from powershell for automation -


i want open excel workbook , read out data, other kinds of operations, etc. know have add assembly reference:

 [reflection.assembly]::loadfile("c:\program files\microsoft office\office16\addins\microsoft power query excel integrated\bin\microsoft.office.interop.excel.dll") 

and need instantiate application object.

$workbook = new-object -typename microsoft.office.interop.excel.application 

this returns error "a constructor not found" isn't way microsoft.office.interop.excel.application interface actually? wondering how can instantiated in this scenario.

you need open comobject.

$excel = new-object -comobject excel.application $workbook = $excel.workbooks.open($filepath) 

in example have needed define $filepath full path excel file trying open.