Important! Read this.

We have launched a new documentation website. If you're using Enterpise Edition 10 (or higher) or Express/Business Edition 2.4.1 (or higher), visit this page.

Skip to end of metadata
Go to start of metadata

We have moved to a new documentation platform. This section is no longer supported. For the up-to-date information, see Table scraping overview.

Example Overview

Problem Statement

Often, information on websites is stored in the form of tables. As this format is inconvenient for automation, we use Excel files to store tables. But copying information from a web page to an .xlsx file takes a lot of time each time. So, we need a use case that can transfer information from a web table to an Excel spreadsheet, and this example is as follows.

Existing Manual Process

To scrap a web table, we need to open a website with a table, select a table, and copy and paste it into an Excel file. It's that simple, but in your own project when you need an updated table for every script run, you will start thinking about automating this action.

Automation Solution

The example uses standard XPaths for the web table and a variable of the Table type. In this case, we have three simple steps: open the website, get the table data line by line, and go to the next page (if you need to scrap more than one page). After the third step, we return to the previous step. On receiving the table, we create a new .xlsx file (using the standard Run application and Excel), or open an existing file and save the table in a specific place in the file.

Installation and Getting Started

  1. Extract the Table scraping folder and drop it into your Workfusion Studio Workspace (C:\Users\name\workfusion-workspace2\rpae_project).
  2. Open the sample in WorkFusion Studio.
  3. Set default values for the following variables:
    1. str_table_xpath – the XPath to a table element on the page;

    2. str_btn_next_xpath (optional) – the XPath to the next page button;
    3. num_how_pages – the number of pages you want to scrap; if you want to scrap only one page, set the value "1" for this variable and you cannot set the value for str_btn_next_xpath;
    4. str_xlsx_file_path – the XPath to the directory where you want to create a new .xlsx file or open an existing one, for example: C:\TablesFolder (without a slash at the end);
    5. str_xlsx_file_name – the file name; if a file with that name does not exist, it will be created, for example: testFile (without a format at the end).
  4. Click on the Play recording button.
  • No labels