Upload a Spreadsheet as a Data Table

Upload a spreadsheet file to Catalytic to create a new Data Table.

Returns a reference to the created Data Table.

Method Signature

uploadDataTable(SplFileObject $file, string $tableName = null, int $headerRow = 1, int $sheetNumber = 1): DataTable


$fileSplFileObjectThe File to upload. Must be a CSV, XLS or XLSX file
$tableNamestringOptional The name of the table to create. Defaults to
the uploaded file name.
$headerRowintOptional The index of row containing column headers.
Row counting starts at 1.
$sheetNumberintOptional The index of the worksheet to import for Excel files.
Defaults to 1.
returnsDataTableThe uploaded Data Table



 * This example demonstrates uploading a Data Table to Cataltyic

require_once(__DIR__ . '/vendor/autoload.php');

use Catalytic\SDK\CatalyticClient;

$catalytic = new CatalyticClient();
$dataTableToUpload = new SplFileObject('/Users/alice/Downloads/example.csv');
$dataTable = $catalytic->dataTables()->upload($dataTableToUpload, 'Example Table');
echo "Uploaded Data Table has id " . $dataTable->getId() . PHP_EOL;