Export Formula #1382
-
Hello, I'm just starting to play with PowerShell and Export-Excel. But im struggeling to export even a simple formular. Simple example:
This leads to a error message in excel:
Hitting yes leads to a empty sheet with the error message:
Maybe Export-Excel does everything correct and it's just Excel itself which don't like "importing" formulas. But I'm not sure if that's the case because I'm new to excel, powershell and export-excel at all. The overall goal is not to implement a simple SUM function, but to add a rather long AND(A2=true;B2=true;C2=false;...;Q2=true) formula in order to check if according to a decision matrix the values captured from a system are compliant. There might be around 500-600 rows and this formula should apply to each row. The ultimate goal is then to use a filter within excel to filter for rows which are not compliant according to the decision matrix (hide but not delete the rows which are compliant). I'll also use conditional format to highlight the individual values which are not compliant. I know that I might just evaluate the compliance within the PowerShell Script and just export true or false to that complicance cell and filter it that way, but I was wondering if export-excel is able to export formulas at all or if its just a excel problem. cheers |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Check out some videos I've donehttps://www.youtube.com/playlist?list=PL5uoqS92stXioZw-u-ze_NtvSo0k0K0kq |
Beta Was this translation helpful? Give feedback.
-
Row Context in Excel FormulasYou can reference the "current row" using structured references. 1] Name your tables using Export-Excel -WorksheetName 'employees' -TableName 'UserList' 2] You can refer to the current row of a table using structured references, like = UserList[@TotalSales] - UserList[@Id] Row Context in PowershellIf you're looking for the row context in powershell, here's an example. All you need to edit is the hashtable. 0..10 | ForEach-Object {
random.user | ForEach-Object {
$curRow = $_
$curRow | Add-Member -Force -ea Ignore -PassThru -NotePropertyMembers @{
# silly example showing the 'row context' when adding 'columns'
IsBasicColor = $curRow.Color -match 'red|orange|green|blue'
IsShort = $_.Color.length -lt 7 -and $_.LastName.length -lt 7
}
}
} | Format-Table |
Beta Was this translation helpful? Give feedback.
Check out some videos I've done
https://www.youtube.com/playlist?list=PL5uoqS92stXioZw-u-ze_NtvSo0k0K0kq