0

I have used the below code to compare the two files excel1 and excel2 and write the difference out to another file, but the output format is way different than expected.

Clear-Host

$File1 = Get-Content C:\Work\Compare\Excel1.xlsx
$File2 = Get-Content C:\Work\Compare\Excel2.xlsx

$Location = C:\Work\Compare\diff.csv

compare-object (get-content $File1) (get-content $File2) | format-list | Out-File $Location

Excel1 enter image description here

Excel2 enter image description here

Output get-content : Illegal characters in path. At C:\Users\lchandrakanthredd\Desktop\Untitled2.ps1:8 char:38

  • compare-object (get-content $File1) (get-content $File2) | format-lis

Appreciate your answers to the above question

Thanks In Advance

3
  • Get-Content reads texts from a file, or the bytes in a binary file into an array, how can it understand the content of xlsx files
    – phuclv
    Aug 5, 2021 at 8:25
  • What is the parameter used to get the data from Excel.?
    – chandu
    Aug 5, 2021 at 9:15
  • 1
    there's none. You must have some library to parse the xlsx file
    – phuclv
    Aug 5, 2021 at 9:25

0

You must log in to answer this question.

Browse other questions tagged .