我有一个 Excel 文件,其中包含未知数量的记录,以及以下 3 列:
Variable Name, Store Number, Email Address
Run Code Online (Sandbox Code Playgroud)
我在 QlikView 中使用它来导入某些商店的数据,然后为列表中的每个商店创建一个单独的报告。然后我需要将每个报告通过电子邮件发送到每个单独的商店(商店编号将在报告文件名中)。
所以在 PowerShell 中,我想读取 Excel 文件并为每个商店设置变量:
$Store1 = The Store Number in Row 2 of the Excel File
$Store1Email = The Store Email in Row 2 of the Excel File
$Store2 = The Store Number in Row 3 of the Excel File
$Store2Email = The Store Email in Row 3 of the Excel File
etc. for each Storein the file (can be any number of stores).
Run Code Online (Sandbox Code Playgroud)
请注意必须忽略 excel 文件中的“变量名称”(即 QLikView),并且必须按照我上面的示例命名 PowerShell 变量,每次增加数字。
Dou*_*nke 14
在 Github 上查看我的 PowerShell Excel 模块。您还可以从 PowerShell 库中获取它。
$stores = Import-Excel C:\Temp\store.xlsx
$stores[2].Name
$stores[2].StoreNumber
$stores[2].EmailAddress
''
'All stores'
'----------'
$stores
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
81057 次 |
| 最近记录: |