I’m new to Powershell and to this fourm.
I created a powershell script that reads from two different excel file and a few sheets within them and writes output to a new sheet in one of the two excel file. The script works perfectly fine from the a subdirectory under my desktop.
However, if I copy the script and the excel files to a folder under c:, the script does not run and locks the excel files as well.
Seems like some basic parameter initiation but couldn’t figure out.
I have these lines at the beginning:
$objExcel = New-Object -ComObject Excel.Application
Will the above lines work from any directory? Do I have to set any powershell configuration parameters (path etc.)?
Everything else in the script is basically assigning sheets to variables and processing cell values and writing to a new sheet.
Appreciate any help!