dfinke/ImportExcel

Not able to surpress 'Warning' on macOS

Closed this issue ยท 13 comments

Maybe a dumb question, but I am not able to suppress the "WARNING: ImportExcel Module Cannot Autosize ..." on macOS. We are using the module in a script and during the script run there is no need for the warning. WarningAction -Ignore did not work and neither did 3>null. If I would use Out-Null or >null I'd have no possibility to -PassTru to use the Excel further on in the Excel-Package. What am I not seeing here? Thank you for your patience.

There is a additional lib that needs to be installed to solve that. Need to review to see if that can be suppressed.

Yes, I saw that I could install the dll and this would be working on my machine. But the script will be used by different people and I am not sure if they got brew installed and how tech savvy they are. It would be delightful if we could avoid any confusion for them.

@ThaMc Let me know if you can think of an alternative.

Next idea was, to change the text color to the same as the background or hide it. But I can't use $PSStyle, as I am not positive, that at least PowerShell 7.2 is used. Trying to go as universal as I ever can. "-WA 0" doesn't work either.

@ThaMc Let me know if you can think of an alternative.

@dfinke I've tried all the things I could think of and still did not find a solution. Any update from your side?

@ThaMc sorry

@ThaMc sorry

FYI, I found a solution. Before using the module the first time call Import-Module -Name ImportExcel 3>$null and that's it.

sweet!

curious, does that drop all error messages on the floor?

Let me check over the next few days, as I'm positive I can produce some.

No worries, no rush, just curious.

Error messages still come through. To test I passed a non-existing parameter.

Image

Excellent, thank you

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.