Hello Handian Sudianto, the AI suggestion above is a good approach, however, if it doesn't work out, you might wanna try some other troubleshooting steps:
First, make sure the module is up to date by running Update-Module ImportExcel. Also, check that the target Excel file isn’t open or locked—this can silently block the export. Running PowerShell as Administrator can help bypass permission issues, especially on corporate machines.
To isolate the problem, try exporting a simple object like this:
$Test = [PSCustomObject]@{Name="Test"; Value=123}
$Test | Export-Excel -Path "$env:USERPROFILE\Desktop\Test.xlsx"
If that works, the issue may be with the structure of your $Result data. Reinstalling the module (Uninstall-Module then Install-Module) can also help if something got corrupted.
Let me know if this helps—and if it does, feel free to hit “Accept Answer” in the corner 😊
Harry.