table load, table load unchanged
This function loads a table from a file. Following file formats are supported:
CSV | Comma separated files | Files separated with a specified symbol, typically a comma, semicolon or tab |
TEXT | Text file | Loads text files into a table consisting of 1 column. Every column contains one line of text. |
HTML | HTML file | Loads a specifically selected table from the HTML file |
FULL HTML | HTML file | Loads a complete HTML file into a sequential table |
XML | XML (extended markup) file | Loads a complete XML file into a sequential table |
JSON | JavaScript Object Notation format | Loads a complete JSON file into a sequential table |
JSON TABLE | JavaScript Object Notation format | Loads a specifically selected JSON table (which is a 2-dimensional array) into a table |
For CSV file formats, the function table load will automatically convert numbers with decimal commas (e.g. 123,456) to numbers with decimal points (123.456)
so they can be processed further and conveniently. This feature is particularly useful with processing data originating from databases or Excel with settings
specific to Germany and some other countries which use decimal commas. If this automatic conversion is not desired because the table data entries with numbers separated
with a comma but seen as actual numbers but possibly a set of two digits, then use the function table load unchanged instead. In this case, value like 123,456 remain unchanged.
Various database systems, including SAP, Oracle, Salesforce which support exports as "Excel" files are in fact HTML or file formats.
A different and dedicated function called table load excel file() is available to load contemporary Excel files with the endings .xlsx, and .xlsm. Prerequisite: File is not encrypted.
Recognizing character formats: B4P tries to automatically identify whether the file is ANSI (ASCII), Win 1252, iso8859-1, and UNICOD: UTF-8, UTF-16 or UTF-16 Big Endian. The identification
is done by preambles in HTML, byte order marks, usage of non-ANSI characters and typical patterns in UTF-16 formats.
Indirect parameter passing is disabled
2-4
No. | Type | Description | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 input |
string | Name of table If the table is existing, then it will be initialized first. | ||||||||||||||||||||||||||
2 input |
string | File name Specify the file name. Add the path in front if the file is not located in the current working directory. | ||||||||||||||||||||||||||
Opt. 3 input |
string | File format descriptor
Default value: CSV or ? | ||||||||||||||||||||||||||
Opt. 4 input |
set | XML attributes to keep Applicable to file format descriptor XML only: | ||||||||||||||||||||||||||
Alt. Opt. 4 input |
string | Text pattern Applicable to file format descriptors HTML, MJTML, JSON TABLE only: |
Type | Description |
---|---|
boolean | Table has contents true if contents have been loaded, false if nothing has been loaded. In this case, the table is empty. |
File not found
File not accessible
File locked
Syntax errors in table formats, e.g in HTML, JSON, XML
File locked. Close the file in the other application and retry
runtime settings[verbose]= quiet; // Supress blabla
echo("Load the Cities file:");
table load( cities, "Examples\Cities.csv" );
echo("Cities: ", join( [cities:City,..], ", " ) );
Load the Cities file:
Cities: New York City, Washington, Philadelphia, Boston, San Francisco, Montréal, Copenhagen, Venice, Los Angeles, Vienna, Bangkok, Zürich, Paris, Davos
table save
table load excel file
loading XML files
loading JSON files