excel - GetValueInvocationException 从 Excel 电子表格中读取单元格
问题描述
这是我遇到的一个非常奇怪的错误。我正在从 Excel 电子表格中读取字段,一切正常。然后我添加了另一列来阅读,但它不再起作用了。
$columnIn = 8
$columnHa = 7
$ExcelSheet.Cells.Item($row,$columnIn).text
$ExcelSheet.Cells.Item($row,$columnHa).text
# These are working quite fine, but when I add
$columnRe = 5
$ExcelSheet.Cells.Item($row, $columnRe).text
# This is the annoying error: GetValueInvocationException
这已经很奇怪了,然后我$columnRe
在调用中而不是值 5Item($row,5).text
并且它起作用了!之后,我将作业更改为演员表:
[int] $ColumnInsight = 6
[int] $ColumnHashtag = 7
[int] $ColumnTypeOfReporter = 5
这也很好用。最后我取消了演员阵容,转身回到
$ColumnInsight = 6
$ColumnHashtag = 7
$ColumnTypeOfReporter = 5
并且......现在它起作用了。为什么?
我什至关闭了 PowerShell ISE 并重新打开它,重新加载了应用程序,但现在它继续正常工作。和以前一样的代码。
解决方案
推荐阅读
- ethereum - Solidity(以太坊)中的“0x0”地址是什么?
- c# - C# Core 2.0 - 根据另一个模型中的数据从一个模型中获取数据?
- xamarin - Xamarin Android - Write to file - access denied
- python - 在 Python 上使用 PIL 更改像素颜色
- java - Spring REST Controller 接受请求正文中的任意元素
- firebase - google firebase 中的 blaze 计划是否足以每天最多调用第三方 api 一百次?
- ios - Need SwiftyJSON model and api call with nested for loops for array with array of dictionaries
- c++ - Guard a section of code from being executed concurrently in a coroutine
- yii2 - Yii2中DynamicFormWidget的自定义验证不起作用
- java - 线程转储分析:意外行为 - 等待线程