Loading HTML files

Prev Next

Introduction

With the procedure table load(), B4P loads tables defined inside HTML files. Only the actual contents and without any tags and formatting features will be loaded. The table must be in the syntax
<table>, <tr> optionally <th> and </th>, </td> and </td>, , </tr>. Script files and nested tables inside tables will be ignored. In order to load a specific table in the HTML file, use the 4th function parameter in the function table load() to specify a text pattern.

  echo(new line, "Look up some Roman emperors:" );
  file download overwrite( "en.wikipedia.org/wiki/List_of_Roman_emperors", Emperors.html );
  table load( emperors, Emperors.html, HTML, 'id="Principate' );
  table keep columns ( emperors, 1 ); // Name only Otherwise the table is too wide
  table list( emperors );
  file delete silently( Emperors.html );
Look up some Roman emperors:
    0 :  Name[f]                                             
    1 : Augustus Caesar Augustus                             
    2 : Tiberius Tiberius Caesar Augustus                    
    3 : Caligula Gaius Caesar Augustus Germanicus            
    4 : Claudius Tiberius Claudius Caesar Augustus Germanicus
    5 : Nero Nero Claudius Caesar Augustus Germanicus        

Try it yourself: Open LIB_Features_Loading_HTML_files.b4p in B4P_Examples.zip. Decompress before use.

See also

table load
Loading FULL HTML files
Loading XML files
Loading JSON files
table load excel file