Problem with StoreText: it prints all table's data into 1 single block

Hi!
I used storetext to get a web table’s data into a csv… the problem is it prints all the data into what would be 1 single cell instead of actually printing each td between commas or tabs so excel or drive understand it as a table and not as a "print everything in A1.

I cannot share with you the url because it is password protected, but here is the script:

{
  "Name": "get table data",
  "CreationDate": "2020-11-30",
  "Commands": [
    {
      "Command": "comment",
      "Target": "open // MY_URL",
      "Value": ""
    },
    {
      "Command": "",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "storeText",
      "Target": "xpath=//*[@id=\"root\"]/div/div[2]/div/main/div/div/div/div/div[2]/div/div/table",
      "Value": "data"
    },
    {
      "Command": "store",
      "Target": "${data}",
      "Value": "!csvLine"
    },
    {
      "Command": "echo",
      "Target": "${!csvLine}",
      "Value": ""
    },
    {
      "Command": "csvSave",
      "Target": "table-data.csv",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!statusok"
    },
    {
      "Command": "comment",
      "Target": "executeScript // return Number (${r}) + 1",
      "Value": "r"
    }
  ]
}

It seem you are using a wrong locator that extracts the complete table at once. You can do this, but then you need to separate (split) the data yourself.

Usually, if you want to extract data from a table (“Table scraping”) you do this cell by cell. Then you need one storeText command per cell. Usually you can solve this with a loop by increasing a certain number in the storeText XPath locator of the cell, and in this way loop over all cells of a certain row. Then you increase another parameter, and you jump to the next row.

Here are some table scraping posts:

In addition to classic webscraping with the storeText command, another interesting way to capture table data automatically is to use a specialized 3rd party Chrome extension like free “Table Capture” (store link) and then use the UI Vision desktop automation feature (XClick) to automate the Chrome extension.

Example: The Table Capture extension has a neat feature where it places inline links into the page that allow you to copy the table content in TAB separated TSV format to the clipboard or even directly push it to Google Sheets (see the screenshot below). In the paid pro version it also supports the CSV format.

How to automate the table capture sequence with the RPA software:

  1. Load the page with the table(s) (OPEN command)
  2. XClick on the extension icon to activate the extension
  3. In the now open table capture extension, xclick on the “Inline…” button
  4. Now UI Vision can simply click on the “Copy to clipboard” button that the extension inserted into the page
  5. Optional: If you need the table data inside the RPA software for further processing, you can get it with the ${!clipboard} internal variable

Screen video:

Complete macro with images:

table capture.zip (3.2 KB)

Inline links inserted by table capture. If you activate the extension manually, you do not need to add the two XClick commands for it (step 2+3).