ImportExcel icon indicating copy to clipboard operation
ImportExcel copied to clipboard

"New-ConditionalText -ConditionalType Equal" equals another cell, not the value i assign

Open Tuumke opened this issue 9 months ago • 3 comments

Trying to setup conditional formatting for cells, but it aint working. Because some users are working with a Dutch version of Excel, i have to account for the Dutch words for true or false, which are waar (true) and onwaar) false. Since both words contain 'waar' i need it to be exact (equal). If i use the default method, both will hit on the 2nd conditional formatting. But when i use the code below, the 'formulate' in the conditional formatting becomes: ="TRUE" instead of TRUE. I can change this manually, but that removes the automation of this process.


$results | Export-Excel $outFile -TableStyle Light8 -WorksheetName "Overzicht" -ConditionalText $(
	New-ConditionalText -ConditionalType Equal TRUE white green
	New-ConditionalText -ConditionalType Equal WAAR white green
	New-ConditionalText -ConditionalType Equal FALSE white red
	New-ConditionalText -ConditionalType Equal ONWAAR white red
)

Tuumke avatar Apr 18 '25 07:04 Tuumke

Just found an old issue from 2016 that has the same issue: https://github.com/dfinke/ImportExcel/issues/134. Workarround doesnt work


$results | Export-Excel $outFile -TableStyle Light8 -WorksheetName "Overzicht" -ConditionalText $(
	New-ConditionalText -ConditionalType Equal '"TRUE"' white green
	New-ConditionalText -ConditionalType Equal '"WAAR"' white green
	New-ConditionalText -ConditionalType Equal '"FALSE"' white red
	New-ConditionalText -ConditionalType Equal '"ONWAAR"' white red
)

Image

Tuumke avatar Apr 18 '25 08:04 Tuumke

don't know off the top of my head. that workarond is what i would've suggested.

dfinke avatar Apr 18 '25 11:04 dfinke

Same when i use a different sheet to check the values:

$valueSheet = $TRUE, $FALSE
$valueSheet | Export-Excel $outFile -WorksheetName "CFSheet"

$results | Export-Excel $outFile -TableStyle Light8 -WorksheetName "Overzicht" -MoveToStart -ConditionalText $(
	New-ConditionalText -ConditionalType Equal CFSheet`!`$A`$1 white green
	New-ConditionalText -ConditionalType Equal CFSheet`!`$A`$2 white red
)

It keeps putting quotes arround it:

Image

Tuumke avatar Apr 18 '25 14:04 Tuumke

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.

stale[bot] avatar Jun 27 '25 02:06 stale[bot]

@dfinke i guess no update on this?

Tuumke avatar Jun 29 '25 06:06 Tuumke

__

dfinke avatar Jun 29 '25 21:06 dfinke

I guess that's one way to solve the problem....

Tuumke avatar Jun 30 '25 10:06 Tuumke

@Tuumke has 2 repos and rolls in with toxic comments

dfinke avatar Jun 30 '25 15:06 dfinke