- Release Notes
- Getting Started
- Tutorials
- Automation Projects
- Creating Automations
- Automation Basics
- Object Repository
- Tutorial: Creating a Pivot Table
- Tutorial: Iterating Through Rows in a Table
- Tutorial: Extracting Data From Automated Emails and Moving It to a Desktop Application
- Tutorial: Filtering Data in Excel
- Tutorial: Formatting Cells
- Tutorial: Adding Information About the Files in a Folder to an Excel File
- Tutorial: Adding Your Own Formulas to the Project Notebook
- Tutorial: Working With Word Automation
- PowerPoint Automation
- Data Automation
- Common Activities
- Google Workspace Automation
- OneDrive & SharePoint Automation
StudioX User Guide
Tutorial: Working With Word Automation
In this tutorial, we will create an automation that generates an individual performance review Word document for each member of a team based on a template Word file and data gathered from several Excel and text files. The template file contains placeholder text and bookmarks that can be populated with values using Word activities. The names of the Excel and text files from which to copy data follow a specific pattern that includes the employee name.
We will start by adding a Use Excel File activity to indicate an Excel file with employee information to add to the automation. Inside it, we will add a For Each Excel Row activity to iterate through the rows with employee data. Inside For Each Excel Row, we will add a Use Word File activity to add the template document to the automation, and then a series of Replace Text, Set Bookmark Content, and Insert DataTable in Document activities will populate each Word file with the necessary information taken for each employee from an Excel file and a text file. Finally, we will add a Save Word File As activity to save the template document as a separate file for each employee.
-
Step 1: Set up the project and get the necessary files.
- Create a new blank project using the default settings.
- Download and extract the archive with the automation project in this tutorial using the button at the bottom of this page. Copy the folder Files to your project folder.
- Create a folder named Output in your project folder.
-
Step 2: Add the Excel with employee data to the project and iterate through the
rows in the file.
- In StudioX, 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. The activity is added to the Designer panel.
-
In the activity:
- Click
Browse
next to the Excel
file field, and then browse to the Files folder and
select the file
Employees.xlsx
. -
In the field Reference as, enter
EmployeeData
.You have indicated that you will work with the file Employees.xlsx that is known in your automation as EmployeeData.
- Click
Browse
next to the Excel
file field, and then browse to the Files folder and
select the file
- Click Add activity inside Use Excel File, and then find the For Each Excel Row activity in the search box at the top of the screen and select it. The activity is added to the Designer panel inside the Use Excel File activity.
-
In the For Each Excel Row activity:
- In the For
each text box, replace
CurrentRow
withEmployee
. -
Click Plus on the right side of the In range field, and then select EmployeeData > Sheet1 [Sheet].
You have indicated that you want to iterate through the rows in Sheet1 from the Employees spreadsheet. Since each row contains information about an employee, the current row in the iteration was renamed Employee to make the information from the row easier to identify later in the automation.
- In the For
each text box, replace
-
Step 3: Add the template Word file to the automation.
- Click Add activity inside For Each Excel Row, and then find the Use Word File activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.
-
In the Use Word File activity:
- Click Browse next to the Word file field, and then browse to the Files folder and select the file PerformanceReviewDoc_template.docx.
-
Clear the Auto save check box. This ensures that the template file is not saved with the data added for each employee.
You have indicated that you will work with the file PerformanceReviewDoc_template.docx.
-
Step 4: Add information from the Excel file with employee data to the Word
file.
- Click Add activity inside Use Word File, and then find the Replace Text activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.
-
In the Replace Text activity:
- Click Plus on the right side of the Search for field, and then select Text. In the Text Builder, enter <<FullName>>.
-
Click Plus on the right side of the Replace with field, and then select Employee > Full Name.
You have indicated that you want to replace the placeholder text <<FullName>> in the Word file with the full name that is copied for each employee from the cell in the Full Name column of the Employees Excel file.
- Click Add activity below the Replace Text activity, and then find the Set Bookmark Content activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.
-
In the Set Bookmark Content activity:
- Click Plus
on the right side of
the Bookmark name field, and then select Text. In
the Text Builder, enter
DirectManager
. -
Click Plus on the right side of the Bookmark text field, and then select Employee > Direct Manager.
You have indicated that, for each employee, you want to add the name of the direct manager to the Word file by copying the contents of the cell in the Direct Manager column of the Employees Excel file and pasting it at the location of the DirectManager bookmark in the Word file.
- Click Plus
on the right side of
the Bookmark name field, and then select Text. In
the Text Builder, enter
-
Repeat steps 3-4 three times to add additional Set Bookmark Content
activities that add the full name, location, and title of each employee
to the Word file. Configure each activity as follows:
- Bookmark name
FullName
, Bookmark text Employee > Full Name - Bookmark name
Location
, Bookmark text Employee > Location -
Bookmark name
PositionTitle
, Bookmark text Employee > Position Title
- Bookmark name
-
Step 5: Add information from the Excel file with data about projects to the
Word file.
- Click Add activity below the last Set Bookmark Content, and then find the Use Excel File activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.
-
In the Use Excel File activity:
-
Click Plus on the right side of the Excel file field, and then select Text.
In the Text Builder:
-
Enter the text
Files\
. - Click Plus on the right side of the Text Builder, and then select Employee > Full Name.
- Enter
the text
_Projects.xlsx
.The text should look like this:Files\[Employee]FullName_Projects.xlsx
. - Click Save in the Text Builder.
-
Enter the text
You have indicated that, for each employee, you want to add the projects Excel file to the automation. Because the selection for Excel file is a dynamic file path and you want to be able to select data in the activities that use the projects files, you indicated one of the files as a template file.
-
- Click Add activity inside the newly added Use Excel File activity, and then find the Insert DataTable in Document activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.
-
In the Insert DataTable in
Document activity:
- Click Plus on the right side of the Table to insert field, and then select Projects > Sheet1 [Sheet] > Table1 [Table].
- From the Insert relative to drop-down menu, select Bookmark.
- Click Plus
on the right side of the
Bookmark to search for field, and then select Text. In
the Text Builder, enter
Projects
. - From the Position where to insert drop-down menu, select After.
You have indicated that, for each employee, you want to copy Table1 from the Projects Excel file and paste it in the Word file after the bookmark named Projects.
-
Step 6: Add information from the text files with manager feedback to the Word
file, and save a separate file for each employee.
- Click Add activity below the newly added Use Excel File activity, and then find the Read Text File activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.
-
In the Read Text File activity:
-
Click Plus on the right side of the File name field, and then select Text.
In the Text Builder:
-
Enter the text
Files\
. - Click Plus on the right side of the Text Builder, and then select Employee > Full Name.
- Enter
the text
_ManagerFeedback.txt
.The text should look like this:Files\[Employee]FullName_ManagerFeedback.txt
. - Click Save in the Text Builder.
-
Enter the text
- In the Properties panel,
click Plus
on the right side of the
Content field, and then select Save for Later Use.
Enter the name
ManagerFeedback
, and click OK.
You have indicated that, for each employee, you want to copy the manager feedback from the text file that contains the employee name in the file name and you want to save the feedback for later use in the automation.
-
- Click Add activity below the Read Text File activity, and then find the Set Bookmark Content activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.
-
In the Set Bookmark Content activity:
- Click Plus
on the right side of the
Bookmark name field, and then select Text. In the Text
Builder, enter
DirectManagerFeedback
. -
Click Plus on the right side of the Bookmark text field, and then select Use Saved Value > ManagerFeedback.
You have indicated that, for each employee, you want to copy the manager feedback that you saved for later use in the Read Text File activity and paste it in the Word file at the location of the DirectManagerFeedback bookmark.
- Click Plus
on the right side of the
Bookmark name field, and then select Text. In the Text
Builder, enter
- Click Add activity below the Set Bookmark Content activity, and then find the Save Word File As activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.
-
In the Save Word File As activity.
-
Click Plus on the right side of the Save as file field, and then select Text.
In the Text Builder:
- Enter the text
Output\
. - Click Plus on the right side of the Text Builder, and then select Employee > Full Name.
-
Enter the text
_PerformanceReview.docx
.The text should look like this:Output\[Employee]FullName_PerformanceReview.docx
. - Click Save in the Text Builder.
- Enter the text
- Leave the default selections for the other options.
You have indicated that you want to save the template file modified with the data of each employee to a new folder called Output. The full name of each employee will be added to the file name using the value in the Full Name column of the Employee Excel file.
-
- Click Save in the StudioX ribbon to save the automation, then click Run to execute the automation.
The automation creates separate performance review Word documents for each employee in the Output folder and populates the files with information from the Excel files with employee data and projects information, and from the text files with manager feedback.