Replace a Data Table

Replace the contents of an existing table with a CSV or Excel file.


Permissions Required

You must have Edit permissions to the data table for this request to succeed

Method Signature

replace(string $id, SplFileObject $file, int $headerRow = 1, int $sheetNumber = 1): DataTable


$idstringThe Id of the Data Table whose contents will be replaced
$fileSplFileObjectThe File to upload. Must be a CSV, XLS or XLSX file
$headerRowintOptional The index of row containing column headers.
Row counting starts at 1.
$sheetNumberintOptional The index of the worksheet to import for Excel files.
Sheet counting starts at 1. Defaults to 1.
returnsDataTableThe Data Table which replaced the previous Data Table



 * This example demonstrates replacing a Data Table in Cataltyic
 * with a file.

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

use Catalytic\SDK\CatalyticClient;

$catalytic = new CatalyticClient();
$dataTableToUpload = new SplFileObject('/Users/alice/Downloads/mycsv2.csv');
$dataTable = $catalytic->dataTables()->replace('7f0594eb-9e02-46f1-b897-a1fc0a9786ca', $dataTableToUpload);