UiPath StudioX

The UiPath StudioX Guide

Tutorial: Filling Out PDF Forms in Acrobat Reader with Data from Excel

In this tutorial, we will create an automation that creates an equipment use agreement PDF form for each new employee at a company. Starting from a template form, the automation creates a form for each employee and populates it with data from an Excel file with information about the equipment received by each employee.

We will start by adding a Create Folder activity to create a folder where to save the PDF files. We will then add a Use Application/Browser activity with a Use Excel File activity inside it. These add the template file opened in Acrobat Reader and the Excel file with equipment data to the automation. In Use Excel File, we will add an Excel For Each Row activity to process the file row by row. In Excel For Each Row, a series of Type Into activities copy the data from cells in each row to the PDF form, and then Keyboard Shortcuts, Click, and Type Into activities perform the tasks required to create a separate PDF in Acrobat Reader for each employee.

Step 1: Set up the project and download the necessary files.

  1. Create a new blank project using the default settings.
  2. Download and extract the archive with the automation project in this tutorial using the button at the bottom of this page. Copy the files EquipmentAgreement.pdf and Employees.xlsx to your project folder, and double-click the PDF file to open it in Acrobat Reader.
  3. In Acrobat Reader, set the Page Layout to Single Page and the Zoom to Default. Do this to ensure that when you run the automation, the entire form is visible on the screen so that the Robot can fill it out. In Acrobat Reader DC, you can change these setting by selecting Edit > Preferences > Page Display.

Step 2: Create a folder and add the files to the project.

  1. Click Add activity plus_icon in the Designer panel, and then find the Create Folder activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.
  2. In the Create Folder activity, click Plus plus button on the right side of the Folder name field, and then select Text. In the Text Builder, enter EquipmentAgreements.
    You have indicated that you want to create a folder named EquipmentAgreements in the project folder.
  3. Click Add activity plus_icon below Create Folder, and then find the Use Application/Browser activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.
  4. In the Use Application/Browser activity:
    • Click Indicate Application, and then move the mouse pointer to the Acrobat window where the PDF is opened. When the window is highlighted in blue, click anywhere inside it.
      The Use Application/Browser activity is updated, a screenshot of the window appears inside the activity, and the path to the executable file appears in the Application Path field.
    • Click Plus plus button on the right side of the Application Arguments field, and then select Text. In the Text Builder, enter EquipmentAgreement.pdf.
      You have indicated that you want the automation to open the file EquipmentAgreement.pdf in Adobe Acrobat.
  5. Click Add activity plus_icon inside Use Application/Browser, 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.
  6. In the Use Excel File activity:

    • Click Browse browse files next to the Excel file field, and then browse to 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.

Step 3: Add activities to repeat for each row in the Excel file.

  1. Click Add activity plus_icon inside Use Excel File, and then find the Excel For Each Row activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.
  2. In the Excel For Each Row activity:

    • Click Plus plus button on the right side of the In range field, and then select EmployeeData > Sheet1 [Sheet]
    • In the field For Each, enter Employee.

    You have indicated that you want to repeat activities for each row in Sheet1 of the EmployeeData file. Because each row contains data about an employee, it will be known in the automation by the name Employee to make it easier to select data from it later in the automation.

  3. Click Add activity plus_icon inside Excel For Each Row, and then find the Type Into activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.
  4. In the Type Into activity:

    • Click Indicate target on screen, then move the mouse pointer on the First Name field in the EquipmentAgreement.pdf file and, when it is highlighted, click the field. The text field is identified as the target and the First Name label next to it is identified as an anchor. Click Confirm in the Selection Options window to save the selection. An image of the target and anchor is displayed in the Type Into activity.
    • Click Plus plus button on the right side of the Type this field, and then select Employee > First Name.

    You have indicated that for each employee you want to copy the value from the First Name column and paste it in the First Name field in the PDF form.

  5. Add four more Type Into activities below the previous Type Into activity. Using the instructions in steps 3-4, configure the activities to copy the Last Name, Role in Company, Equipment Model, and Equipment Serial No for each employee, and paste them in the corresponding fields in the PDF form.
  6. Add a sixth Type Into activity inside Excel For Each Row after the last Type Into activity.
  7. In the Type Into activity:

    • Click Indicate target on screen, then move the mouse pointer on the Full Name field in the EquipmentAgreement.pdf file and, when it is highlighted, click the field. The text field is identified as the target and the Full Name label next to it is identified as an anchor. Click Confirm in the Selection Options window to save the selection. An image of the target and anchor is displayed in the Type Into activity.
    • Click Plus plus button on the right side of the Type this field, and then select Text.
      In the Text Builder, compose a text that contains the first and last name of each employee from the Excel file separated by a space:
      a. Click Plus plus button on the right side, and then select Employee > First Name.
      b. Add a space.
      c. Click Plus plus button on the right side, and then select Employee > Last Name.
      d. Click Save.

    You have indicated that for each employee you want to copy the values from the First Name and Last Name columns, and paste them in the Full Name field in the PDF form.

  8. Add a seventh Type Into activity inside Excel For Each Row after the last Type Into activity.
  9. In the Type Into activity:

    • Click Indicate target on screen, then move the mouse pointer on the Date field in the EquipmentAgreement.pdf file and, when it is highlighted, click the field. The text field is identified as the target and the Date label next to it is identified as an anchor. Click Confirm in the Selection Options window to save the selection. An image of the target and anchor is displayed in the Type Into activity.
    • Click Plus plus button on the right side of the Type this field, and then select Project Notebook (Notes) > Date [Sheet] > Today [Cell].

    You have indicated that for each employee you want to copy today's date from a cell in the Project Notebook and paste it in the Date field in the PDF form.

  10. Click Add activity plus_icon below the last Type Into activity inside Excel For Each Row, and then find the Keyboard Shortcuts activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.
  11. In the Keyboard Shortcuts activity, click Record Shortcut, and then press the following key combination on your keyboard: CTRL SHIFT S.
    You have indicated that you want to save the PDF file by pressing CTRL+SHIFT+S. When the automation is executed, this combination opens the Save as dialog in Acrobat Reader.
  12. In the Acrobat Reader window where the file is opened, press CTRL SHIFT S on your keyboard to open the Save as dialog.
  13. In StudioX, click Add activity plus_icon below the Keyboard Shortcuts activity inside Excel For Each Row, and then find the Click activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.
  14. In the Click activity, click Indicate target on screen, then move the mouse pointer on the Choose a different folder button in the Save as dialog and, when it is highlighted, click the button. The button is identified as the target and the Cancel button next to it is identified as an anchor. Click Confirm in the Selection Options window to save the selection. An image of the target and anchor is displayed in the Click activity.
    You have indicated that you want to click Choose a different folder to open the Save as dialog in the file explorer.
  15. In the Acrobat Reader window where the file is opened, click Choose a different folder in the Save as dialog.
  16. In the StudioX ribbon, select Project > Open Project Folder to open the project folder in the file explorer, and then copy the full path to the folder from the address (location) bar.
  17. In StudioX, click Add activity plus_icon below the Click activity inside Excel For Each Row, and then find the Type Into activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.
    In the Type Into activity:
    • Click Indicate target on screen, then move the mouse pointer on the File name field in the Save as file explorer dialog and, when it is highlighted, click the field. The field is identified as the target and the File name label next to it is identified as an anchor. Click Confirm in the Selection Options window to save the selection. An image of the target and anchor is displayed in the Type Into activity.
    • Click Plus plus button on the right side of the Type this field, and then select Text.
      In the Text Builder:
      a. Paste the path copied in step 16.
      b. Enter \EquipmentAgreements\EquipmentAgreement_.
      c. Click Plus plus button on the right side, and then select Employee > First Name.
      d. Click Plus plus button on the right side, and then select Employee > Last Name.
      e. Click Plus plus button on the right side, and then select Special Keys > Enter.
      f. Click Save.
      The text should look as in the following image:

You have indicated that you want to save each PDF file in the EquipmentAgreements folder with a file name that includes the employee name.
The Excel For Each Row activity should look like in the following image (for a larger view, right-click the image and save it):

  1. Click Save in the StudioX ribbon to save the automation.
  2. To avoid any issues during execution, make sure there are no PDF files opened in Adobe Acrobat. and then click Run to execute the automation.

The values are copied from the Excel file to the PDF form for each employee and each PDF is saved with the employee name in the newly created folder.

Download example

Updated 2 months ago


See Also

Tutorials

Tutorial: Filling Out PDF Forms in Acrobat Reader with Data from Excel


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.