获取单元格内容
动词:getTableCell
获取位于列和行交叉处的单元格的内容。
语法
getTableCell --dataTable(DataTable) --column(Numeric) --row(Numeric) (Scalar)=value
输入
| 脚本 | 设计器 | 必需的 | AcceptedTypes | 描述 |
|---|---|---|---|---|
| --dataTable | 数据表 | 必需的 | 数据表 | 从中获取单元格内容的数据表。 |
| --column | 列 | 必需的 | 成员 | 单元格所在的列的数字位置。指示列位置的数字,必须大于或等于 1。 |
| --row | 行 | 必需的 | 成员 | 单元格所在的行的数字位置。指示行位置的数字,必须大于或等于 1。 |
输出
| 脚本 | 设计器 | AcceptedTypes | 描述 |
|---|---|---|---|
| 值 | 内容 | 原语 | 返回获取的单元格的内容。 |
示例
使用该命令通过列号后跟交叉行号找到特定单元格,获取其内容。
defVar --name excelFile --type Excel
defVar --name excelTable --type DataTable
defVar --name cellContent --type String
// Download the following file to execute the command.
excelOpen --file "tableExcelCompanyCity.xlsx" excelFile=value
excelGetTable --file ${excelFile} --getfirstsheet --entiretable --hasheaders excelTable=value
getTableCell --dataTable ${excelTable} --column 2 --row 3 cellContent=value
logMessage --message "Cell Content: ${cellContent}" --type "Info"
// This example returns the following output:
// Cell contents: Armonk.
要正确处理上述脚本,需要下载该文件并在打开 Excel 文件命令的文件参数中输入其路径。