Upload a Spreadsheet as a Data Table

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

Method Signature

upload(filePath: string): Promise<DataTable>;
upload(filePath: string, tableName: string): Promise<DataTable>;
upload(filePath: string, tableName: string, headerRow: number): Promise<DataTable>;
upload(filePath: string, tableName: string, headerRow: number, sheetNumber: number): Promise<DataTable>;
upload(filePath: string, callback: (err?: Error, dataTable: DataTable) => any): void;
upload(filePath: string, tableName: string, callback: (err?: Error, dataTable: DataTable) => any): void;
upload(filePath: string, tableName: string, headerRow: number, callback: (err?: Error, dataTable: DataTable) => any): void;
upload(filePath: string, tableName: string, headerRow: number, sheetNumber: number, callback: ClientMethodCallback<DataTable>): void;

Parameters

ParameterTypeDescription
filePathstringThe local path of the CSV, XLS or XLSX file
to upload as a Data Table
tableNamestringOptional The name of the table to create. Defaults to
the uploaded file name.
headerRownumberOptional The index of row containing column headers.
Row counting starts at 1.
sheetNumbernumberOptional The index of the worksheet to import for Excel files.
Defaults to 1.
returnsDataTableThe newly created Data Table

Example

/*
 * This example demonstrates uploading a Data Table to Cataltyic
 */
const { CatalyticClient } = require('@catalytic/sdk');

const catalytic = new CatalyticClient();

const filePath = '/path/to/local/file.xlsx';
const tableName = 'New Data Table';
const headerRow = 1;
const sheetNumber = 1;
const dataTable = await catalytic.files.upload(filePath, tableName, headerRow, sheetNumber);

console.log(`Uploaded Data Table has ID "${dataTable.id}"`);