Replies: 4 comments 2 replies
-
Thanks for trying ImportExcel and the question. I always forget. Setting filters for either for Auto Filter and Pivot Filters can only be set after Excel renders the xlsx. I believe it is both. @jhoneill Did the deeper dive on this. |
Beta Was this translation helpful? Give feedback.
-
Yes, it is both. What a lot of people would like is to be able to create a table with a filter, or a pivot table and set "Order By" or "Select Where" on it. |
Beta Was this translation helpful? Give feedback.
-
@Shanefe - you can poke stuff into a running copy of Excel from PowerShell - last time I did that it was done with COM objects, and I think that's what the Interop libraries do. [Obviously] we try to avoid things in the module which have dependencies on having excel installed - I was just doing something a server where we can put Excel to mail results to people as spreadsheets. Often the quickest way to get the code you want is to record it as a macro in Excel and then translate those operations into com calls. |
Beta Was this translation helpful? Give feedback.
-
Here is some sample code that works as long as you have the Microsoft.Office.Interop.Excel.dll accessible. function SortTable {
} |
Beta Was this translation helpful? Give feedback.
-
Using your GetProcess example, how would you go about only showing Running processes?
I do not want to eliminate all the other data (i.e. sorting in PS), I just want the data hidden, i.e. just filter on "running", by default.
I need to be able to show a simplified view that will work most of the time, but the users will be able to change the 'default' filter if needed.
Get-Service | Select-Object -Property Status,Name,DisplayName,StartType |
Export-Excel -Path .\test.xlsx -AutoSize -AutoFilter -Show
Seems like it should be some type of conditional check, but I have been unable to find it.
-ConditionalText $(
New-ConditionalText Running -ConditionalTextColor Green)
Beta Was this translation helpful? Give feedback.
All reactions