更新行

动词:updateRow

可从以下位置获取: <Standard>

更新特定表行中的现有值。

语法

updateRow --index(Numeric) [--valuesmapping(String)] [--valueset(StringDictionary<String>)] --dataTable(DataTable)

输入

脚本 设计器 必需的 AcceptedTypes 描述
--index 索引 必需的 成员 指示应更新的行位置的数字。
--valuesmapping 值映射 可选 文本 使用在“值”字段中输入的值更新特定行的“参数”字段中映射的列。
--valueset 值集 可选 字符串字典<Text>列表<Primitives> 用于更新索引中指定的行的值列表。
这些值按顺序更新行,即第一个值更新第一列,第二个值更新第二列,依此类推。
--dataTable 数据表 必需的 数据表 应更新其中某行的数据表。

示例

示例 1:使用在值映射中输入的值更新表的特定行。

defVar --name excelFile --type Excel
defVar --name excelSheet --type DataTable
// Table filled with values.
excelOpen --file "tableExcelCompanyCity.xlsx" excelFile=value
excelGetTable --file ${excelFile} --getfirstsheet  --entiretable  --hasheaders  excelSheet=value
//
updateRow --index 3 --valuesmapping "City=Brasília" --dataTable ${excelSheet}
excelClose --file ${excelFile}
logMessage --message "${excelSheet}" --type "Info"
// The example above returns the following output:
// Company, City
// IBM Corporation, Toronto
// Microsoft Corporation, São Paulo
// IBM Corporation, Brasília

示例 2:根据文本列表中的数据更新表的特定行。

defVar --name excelFile --type Excel
defVar --name excelSheet --type DataTable
defVar --name valuesList --type List --innertype String --value "[Google,Califórnia]"
// Table filled with values.
excelOpen --file "tableExcelCompanyCity.xlsx" excelFile=value
excelGetTable --file ${excelFile} --getfirstsheet  --entiretable  --hasheaders  excelSheet=value
//
updateRow --index 3 --valueset ${valuesList} --dataTable ${excelSheet}
excelClose --file ${excelFile}
logMessage --message "${excelSheet}" --type "Info"
//The example above resumes the following output:
//Company, City
//IBM Corporation, Toronto
//Microsoft Corporation, São Paulo
//Google, Califórnia

下载文件


要正确操作以上脚本,必须下载该文件并在打开 Excel 文件命令的文件参数中输入其路径。

备注

索引参数中输入的值必须介于 1 到 2147483647 之间。

索引中输入的值不能超出表中行数。

要执行此命令,必须在以下其中一个参数中输入值:值映射值集。 这两个字段中不能同时具有值。

值集中,如果设置的值的数量大于表列的数量,那么将忽略这些值;如果小于表列的数量,那么将更新尽可能多的列,其余列的其他值保持不变。

另请参阅

  • 添加列
  • 添加行
  • 检查列在表中是否存在
  • 复制行
  • 复制表
  • 删除列
  • 删除行
  • 过滤表
  • 按名称查找列
  • 查找表单元格出现项
  • 获取单元格内容
  • 获取列名
  • 获取列结构
  • 获取 HTML 表
  • 基于 JSON 生成表
  • 映射表行
  • 移动表行
  • 对表排序
  • 将表写入文件