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
DataTable upload(File fileToUpload, String tableName);
DataTable upload(File fileToUpload, String tableName, Integer headerRow, Integer sheetNumber);
Parameters
Parameter | Type | Description |
---|---|---|
fileToUpload | File | The File to upload. Must be a CSV, XLS or XLSX file |
tableName | String | The name of the table to create. Defaults to the uploaded file name. |
headerRow | Integer | The index of row containing column headers. Row counting starts at 1. |
sheetNumber | Integer | The index of the worksheet to import for Excel files. Defaults to 1. |
returns | DataTable | The uploaded Data Table |
Example
/*
* This example demonstrates uploading a Data Table to Cataltyic
*/
import org.catalytic.sdk.CatalyticClient;
import java.io.File;
public class Program {
public static void main(String[] args) throws Exception {
// Create and Initialize Catalytic SDK Client
CatalyticClient catalytic = new CatalyticClient();
// Upload spreadsheet as a Data Table
File file = new File("/Users/alice/table.csv");
DataTable dataTable = catalytic.dataTables().upload(file, "My Table");
System.out.println("Uploaded DataTable has ID " + dataTable.getId());
}
}
Updated about 3 years ago