- 发行说明
- 入门指南
- 教程
- 自动化项目
- 创建自动化
在本教程中,我们有一个 Excel 文件,其中包含有关供应商的数据,我们希望找出每个城市有多少个供应商,以及这些供应商在每个城市中有多少名员工。为此,我们将构建一个自动化程序来创建数据透视表。
-
步骤 1:设置项目并获取必要的文件
- Create a new blank project using the default settings.
- 使用此页面底部的按钮,下载并提取本教程中自动化项目的存档文件。将“
Suppliers.xlsx”文件复制到您的项目文件夹。
-
步骤 2:将 Excel 文件添加到项目中。
-
Click Add activity
in the Designer panel, and then find the Use Excel File activity in the search box at the top of the screen and select it. A Use Excel File activity is added to the Designer panel. -
在活动中:
-
Click Browse
next to the Excel file field, and then browse to and select the file Suppliers.xlsx -
在“引用为”字段中,输入
Suppliers。您已指明将使用自动化中称为
Suppliers的文件Suppliers.xlsx。
-
-
-
步骤 3:添加并配置“创建透视表”活动。
在 Suppliers.xlsx 文件的“输出”表中创建透视表。
-
In the Use Excel File activity, click Add activity
, then find the Create Pivot Table activity in the search box at the top of the screen and double-click it. The activity is added inside the Use Excel File activity. -
在“创建透视表”活动中,定义来源范围和创建透视表的范围:
a) Click Plus
on the right side of the Source range field, and then select Suppliers > Indicate in Excel.b) 在 Excel 文件中,选择“I“”表中的所有列,然后在 Excel 功能区的“UiPath”选项卡中单击“确认”。
您已指明要在 Excel 文件“Suppliers”的“Input”工作表中为 A-L 列创建透视表。表格范围字段将您的选择显示为 [Suppliers] Input!A:L。
c) 单击加号
单击“新表格名称”字段右侧的,然后选择“文本” 。在文本生成器窗口中,输入透视表的名称,例如CountByCity,然后单击保存。d) Click Plus
on the right side of the Destination range field and then select Suppliers > Output [Sheet].您已指明要在 Excel 文件“Suppliers”的“Input”工作表中创建透视表。“目的”范围字段将您的选择显示为 [Suppliers] Output。
-
在“创建透视表”活动中,添加透视表字段:
a) 单击“添加透视表字段”按钮,然后单击加号
单击“字段”右侧的,然后选择“范围” > “城市” 。b) 从“是”下拉菜单中,选择“行”。
您已指明要让 Excel 文件“Suppliers”中“Input”工作表中“City”列中的条目成为透视表中的行。
c) 再次单击“添加透视表字段”按钮,以在透视表中添加第二个字段,对供应商进行计数。
在第二个“透视字段”中,单击加号
然后选择“范围” > “内部名称” 。d) 从“是”下拉菜单中选择“值”,然后从“功能”下拉菜单中选择“计数”。
您已指明要对以 Excel 文件“Suppliers”的“Input”工作表中“内部名称”列标识的供应商进行计数。
e) 再次单击“添加透视表字段”按钮,在透视表中添加第三个字段,以汇总员工人数。
在第三个“透视字段”中,单击加号
然后选择“范围” > “员工数” 。f) 从“是”下拉菜单中选择“值”,然后从“函数”下拉菜单中选择“求和”。
您已指明要在 Excel 文件“Suppliers”的“Input”工作表中汇总员工人数。
g) 为了使“透视字段”更容易识别,请在各字段上方的栏中编辑名称。例如,第一个使用
Pivot Field City,第二个使用Pivot Field Name,第三个使用Pivot Field Employees。 -
在 StudioX 功能区中单击“保存”,以保存自动化,然后单击“运行”来执行此自动化。
-