Get HTML Tables

Verb: getTablesFromHtml

Gets all tables from an HTML code.

Syntax

getTablesFromHtml --html(String) (Boolean)=success (DataTable)=first (List<DataTable>)=values

Inputs

Script Designer Required AcceptedTypes Description
--html Html Required Text HTML code containing the table that should be obtained.
--removehtml Remove HTML Optional Boolean When enabled, removes the HTML tags from the table content after it is fetched.

Outputs

Script Designer AcceptedTypes Description
success Success Boolean Returns "True" if the table was successfully fetched, or "False" if not.
first First Values Data Table Data table containing values obtained from the first table from the HTML code.
values Values List<Data Table> Lists the values of all tables obtained from the HTML code.

Example

The Get HTML Tables command gets two tables contained in the HTML code, returning "True" to indicate success, the values ​​of the first table and the listing of all existing tables in the code.

defVar --name success --type Boolean
defVar --name firstValues --type DataTable
defVar --name valuesList --type List --innertype DataTable
getTablesFromHtml --html "<!DOCTYPE html>\r\n<html>\r\n<head>\r\n</head>\r\n<body>\r\n<table>\r\n  <tr>\r\n    <th>Month</th>\r\n    <th>Day</th>\r\n  </tr>\r\n  <tr>\r\n    <td>January</td>\r\n    <td>31</td>\r\n  </tr>\r\n  <tr>\r\n    <td>February</td>\r\n    <td>28 or 29</td>\r\n  </tr>\r\n</table>\r\n<table>\r\n  <tr>\r\n    <th>Month</th>\r\n    <th>Day</th>\r\n  </tr>\r\n  <tr>\r\n    <td>May</td>\r\n    <td>31</td>\r\n  </tr>\r\n  <tr>\r\n    <td>June</td>\r\n    <td>30</td>\r\n  </tr>\r\n</table>\r\n\r\n</body>\r\n</html>\r\n" firstValues=first success=success valuesList=values
// After execution, the variable "valuesList" will contain the table data obtained in the code.
logMessage --message "First Values: ${firstValues}\r\nValues List: ${valuesList}\r\nSuccess: ${success}" --type "Info"

See Also

  • Add Column
  • Add Row
  • Check for Column Existence in Table
  • Copy Rows
  • Copy Table
  • Delete Column
  • Delete Rows
  • Filter Table
  • Find Column by Name
  • Find Table Cell Occurrences
  • Get Cell Contents
  • Get Column Name
  • Get Column Structure
  • JSON to Table
  • Map Table Row
  • Move Table Rows
  • Sort Table
  • Update Row
  • Write Table to File