【发布时间】:2018-12-20 18:01:06
【问题描述】:
我有一个 Excel 文件,我正在读取该文件以填充参数 ARM JSON 文件。
我使用的代码是
$ws = $wb.Worksheets.Item(1)
$data = Get-Content -Path "$path\$jsonfile" -Raw | ConvertFrom-Json
$Row = 2
$col = 2
$data.parameters.client.value = $ws.Cells.Item($Row, $col).Value()
$data.parameters.user.value = $ws.Cells.Item($Row, $col).Offset(1, 0).Value()
$data.parameters.business.value = $ws.Cells.Item($Row, $col).Offset(2, 0).Value()
$data.parameters.dev.value = $ws.Cells.Item($Row, $col).Offset(3, 0).Value()
$data | ConvertTo-Json -Depth 9 | % {
[System.Text.RegularExpressions.Regex]::Unescape($_)
} | Set-Content -Path "$newpath\$JSONFile"
我需要商业价值成为“关键”:“价值”
在我的 excel 中,我有以下字段
Name Value Key
$client Client1
$user User1
$business Bus-key bus-value
我不知道如何将“key”:“value”添加到 excel 并让 powershell 读取它并填充参数表。
客户端和用户值是字符串,所以可以正常工作。
我希望在哪里出错
提前致谢:)
【问题讨论】:
-
您能否添加一个 JSON/Excel 文件示例以及您希望在 JSON/Excel 文件中看到的内容?
-
@DarkLite1 嗨,我已经上传了我正在努力实现和超越的图像:pastebin.com/embed_iframe/LW9RP80s
标签: excel azure powershell