Repository navigation
Data type fix in Export-Excel - #1749
scriptingstudio wants to merge 1 commit into
Conversation
Data type fix in Export-Excel
There was a problem hiding this comment.
🟢 Approval recommended
The localized conversion addresses the reported defect; regression coverage is recommended but nonblocking.
1 open finding
What changed in this PR
Fixes character-valued properties exporting as 0, addressing the reported Get-Volume drive-letter issue.
Changes:
- Converts
[char]values to strings before assigning Excel cells. - Preserves handling of other value types and number formatting.
| File | Description |
|---|---|
| Public/Export-Excel.ps1 | Converts character values to strings during export. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } | ||
| elseif ($v -is [System.ValueType]) { | ||
| $ws.Cells[$row, $ColumnIndex].Value = $v | ||
| $ws.Cells[$row, $ColumnIndex].Value = if ($v -is [char]) {$v.ToString()} else {$v} |
|
In a nutshell: AI confirms my assumption and states the obvious. |
|
well, it's the first time being reporting in, a decade (maybe there was another) and there is a simple work around |



This is based on #1748 where Excel renders
chardata as "0".Besides this, Excel COM-object converts
chardata into its decimal representation. It's impossible to explain such Excel's behavior, so it's the easiest way is to convertchartype data intostring.Proposed solution
No single line added, just one extended assignment at line 319: