====== uploadAsTable() ======
''array **uploadAsTable**(string //variable//, [int //sheetIndex//])''
The function ''uploadAsTable()'' opens an Excel or CSV file uploaded by the respondent and returns the tabular content as an array.
* //variable//\\ The ID of the variable that belongs to the upload, or the ID of the upload question.
* //sheetIndex// (optional)\\ The index of the sheet (table) within an Excel file that shall be read, counted from 0. By default, the first sheet (table with index 0) is read.
===== Return Value =====
If the file cannot be opened as a table, the function returns ''null''.
Otherwise, an array of all rows is returned, with each entry again being an array with the cells of that row.
[
['ID', 'Fruit', 'Quantity'],
[1, 'Apple, Gala', '72'],
[2, 'Apple, Braeburn', '19'],
[3, 'Pear, Conference', '34']
]
**Tip:** While developing the PHP code, you can display an excerpt of the table by using ''debug()''.
$data = uploadAsTable('UP01');
debug($data);
if (!$data) {
// Error message: No file or wrong file format
} elseif (!in_array('ID', $data[0])) {
// Error message: A column with the heading "ID" is missing
} else {
// Process the input
}