I'm trying to build a script with the Powershell Excel COM object which reads an XLSX file and looks at the columns. If it matches the columns of the target XLSX file I want it to append the data to the target. How should I start?
I already managed to do it with TXT files (turning it to objects and appending to XLSX) and now I'm trying to do the same with XLSX.
Thanks!
I would't really recommend working with Excel through COM Objects when ImportExcel exists, I've used this module for a couple of years now, and its simply awesome. I'm leaving an example of how can you do what you want with this module:
Import-Excel .\Object2.xlsx | Export-Excel .\Object1.xlsx -Append
This only appends data from the same column names or "properties" so no need to check.
Hope it helps, and thanks to dfinke for creating this awesome module.