# Structured Sheets ## List structured sheets `client.structuredSheets.list(StructuredSheetListParamsquery?, RequestOptionsoptions?): CursorIDPage` **get** `/v1/structured-sheets` List all structured sheets conversions for the authenticated user. Results are paginated using cursor-based pagination. ### Parameters - `query: StructuredSheetListParams` - `after?: string | null` A cursor for pagination. Use the `last_id` from a previous response to fetch the next page of results. - `limit?: number` Maximum number of results to return per page. ### Returns - `StructuredSheetResponse` Response representing a structured sheet conversion job. This is returned from POST (create), GET (retrieve), and list endpoints. - `id: string` The unique identifier for this structured sheet conversion. - `created_at: string` The timestamp when the conversion was started. - `file_id: string` The unique identifier for the source file. - `object: "structured_sheet"` The object type, which is always 'structured_sheet'. - `"structured_sheet"` - `status: "queued" | "in_progress" | "completed" | 2 more` The current processing status. - `"queued"` - `"in_progress"` - `"completed"` - `"failed"` - `"cancelled"` - `updated_at: string` The timestamp when the conversion was last updated. - `last_error?: LastError | null` Error information when processing fails. - `code: string` A machine-readable error code. - `message: string` A human-readable description of the error. - `sheet_names?: Array` List of sheet names included in this conversion. - `table_count?: number | null` Number of tables extracted from the workbook. Only present when status is 'completed'. ### Example ```typescript import DeepTable from '@deeptable/deeptable'; const client = new DeepTable({ apiKey: process.env['DEEPTABLE_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const structuredSheetResponse of client.structuredSheets.list()) { console.log(structuredSheetResponse.id); } ``` #### Response ```json { "data": [ { "id": "ss_01kfxgjd94fn9stqm42nejb627", "created_at": "2024-01-15T10:30:00Z", "file_id": "file_01kfxgjd94fn9stqm414vjb0s8", "object": "structured_sheet", "status": "completed", "updated_at": "2024-01-15T10:35:00Z", "last_error": { "code": "invalid_file_format", "message": "The uploaded file is not a valid Excel spreadsheet." }, "sheet_names": [ "Sheet1", "Financials" ], "table_count": 6 } ], "has_more": false, "object": "list", "first_id": "ss_01kfxgjd94fn9stqm42nejb627", "last_id": "ss_01kfxgjd94fn9stqm42nejb627" } ``` ## Create structured sheet `client.structuredSheets.create(StructuredSheetCreateParamsbody, RequestOptionsoptions?): StructuredSheetResponse` **post** `/v1/structured-sheets` Start converting a spreadsheet workbook into structured data. This initiates an asynchronous conversion process. Poll the returned resource using the `id` to check completion status. ### Parameters - `body: StructuredSheetCreateParams` - `file_id: string` The unique identifier of the file to convert. - `sheet_names?: Array | null` List of sheet names to convert. If None, all sheets will be converted. ### Returns - `StructuredSheetResponse` Response representing a structured sheet conversion job. This is returned from POST (create), GET (retrieve), and list endpoints. - `id: string` The unique identifier for this structured sheet conversion. - `created_at: string` The timestamp when the conversion was started. - `file_id: string` The unique identifier for the source file. - `object: "structured_sheet"` The object type, which is always 'structured_sheet'. - `"structured_sheet"` - `status: "queued" | "in_progress" | "completed" | 2 more` The current processing status. - `"queued"` - `"in_progress"` - `"completed"` - `"failed"` - `"cancelled"` - `updated_at: string` The timestamp when the conversion was last updated. - `last_error?: LastError | null` Error information when processing fails. - `code: string` A machine-readable error code. - `message: string` A human-readable description of the error. - `sheet_names?: Array` List of sheet names included in this conversion. - `table_count?: number | null` Number of tables extracted from the workbook. Only present when status is 'completed'. ### Example ```typescript import DeepTable from '@deeptable/deeptable'; const client = new DeepTable({ apiKey: process.env['DEEPTABLE_API_KEY'], // This is the default and can be omitted }); const structuredSheetResponse = await client.structuredSheets.create({ file_id: 'file_01h45ytscbebyvny4gc8cr8ma2', }); console.log(structuredSheetResponse.id); ``` #### Response ```json { "id": "ss_01kfxgjd94fn9stqm42nejb627", "created_at": "2024-01-15T10:30:00Z", "file_id": "file_01kfxgjd94fn9stqm414vjb0s8", "object": "structured_sheet", "status": "completed", "updated_at": "2024-01-15T10:35:00Z", "last_error": { "code": "invalid_file_format", "message": "The uploaded file is not a valid Excel spreadsheet." }, "sheet_names": [ "Sheet1", "Financials" ], "table_count": 6 } ``` ## Delete structured sheet `client.structuredSheets.delete(stringstructuredSheetID, RequestOptionsoptions?): StructuredSheetDeleteResponse` **delete** `/v1/structured-sheets/{structured_sheet_id}` Delete a structured sheet conversion and its associated exports. This action cannot be undone. ### Parameters - `structuredSheetID: string` The unique identifier of the structured sheet conversion. ### Returns - `StructuredSheetDeleteResponse` Response from deleting a structured sheet. Following the OpenAI API convention for delete responses. - `id: string` The unique identifier of the deleted structured sheet. - `deleted: true` Whether the structured sheet was successfully deleted. - `true` - `object: "structured_sheet"` The object type, which is always 'structured_sheet'. - `"structured_sheet"` ### Example ```typescript import DeepTable from '@deeptable/deeptable'; const client = new DeepTable({ apiKey: process.env['DEEPTABLE_API_KEY'], // This is the default and can be omitted }); const structuredSheet = await client.structuredSheets.delete('ss_01kfxgjd94fn9stqm42nejb627'); console.log(structuredSheet.id); ``` #### Response ```json { "id": "ss_01kfxgjd94fn9stqm42nejb627", "deleted": true, "object": "structured_sheet" } ``` ## Retrieve structured sheet `client.structuredSheets.retrieve(stringstructuredSheetID, RequestOptionsoptions?): StructuredSheetResponse` **get** `/v1/structured-sheets/{structured_sheet_id}` Get the status and details of a structured sheet conversion. ### Parameters - `structuredSheetID: string` The unique identifier of the structured sheet conversion. ### Returns - `StructuredSheetResponse` Response representing a structured sheet conversion job. This is returned from POST (create), GET (retrieve), and list endpoints. - `id: string` The unique identifier for this structured sheet conversion. - `created_at: string` The timestamp when the conversion was started. - `file_id: string` The unique identifier for the source file. - `object: "structured_sheet"` The object type, which is always 'structured_sheet'. - `"structured_sheet"` - `status: "queued" | "in_progress" | "completed" | 2 more` The current processing status. - `"queued"` - `"in_progress"` - `"completed"` - `"failed"` - `"cancelled"` - `updated_at: string` The timestamp when the conversion was last updated. - `last_error?: LastError | null` Error information when processing fails. - `code: string` A machine-readable error code. - `message: string` A human-readable description of the error. - `sheet_names?: Array` List of sheet names included in this conversion. - `table_count?: number | null` Number of tables extracted from the workbook. Only present when status is 'completed'. ### Example ```typescript import DeepTable from '@deeptable/deeptable'; const client = new DeepTable({ apiKey: process.env['DEEPTABLE_API_KEY'], // This is the default and can be omitted }); const structuredSheetResponse = await client.structuredSheets.retrieve( 'ss_01kfxgjd94fn9stqm42nejb627', ); console.log(structuredSheetResponse.id); ``` #### Response ```json { "id": "ss_01kfxgjd94fn9stqm42nejb627", "created_at": "2024-01-15T10:30:00Z", "file_id": "file_01kfxgjd94fn9stqm414vjb0s8", "object": "structured_sheet", "status": "completed", "updated_at": "2024-01-15T10:35:00Z", "last_error": { "code": "invalid_file_format", "message": "The uploaded file is not a valid Excel spreadsheet." }, "sheet_names": [ "Sheet1", "Financials" ], "table_count": 6 } ``` ## Cancel structured sheet processing `client.structuredSheets.cancel(stringstructuredSheetID, RequestOptionsoptions?): StructuredSheetResponse` **post** `/v1/structured-sheets/{structured_sheet_id}/cancel` Cancel a structured sheet conversion that is in progress. Only jobs with status 'queued' or 'in_progress' can be cancelled. ### Parameters - `structuredSheetID: string` The unique identifier of the structured sheet conversion. ### Returns - `StructuredSheetResponse` Response representing a structured sheet conversion job. This is returned from POST (create), GET (retrieve), and list endpoints. - `id: string` The unique identifier for this structured sheet conversion. - `created_at: string` The timestamp when the conversion was started. - `file_id: string` The unique identifier for the source file. - `object: "structured_sheet"` The object type, which is always 'structured_sheet'. - `"structured_sheet"` - `status: "queued" | "in_progress" | "completed" | 2 more` The current processing status. - `"queued"` - `"in_progress"` - `"completed"` - `"failed"` - `"cancelled"` - `updated_at: string` The timestamp when the conversion was last updated. - `last_error?: LastError | null` Error information when processing fails. - `code: string` A machine-readable error code. - `message: string` A human-readable description of the error. - `sheet_names?: Array` List of sheet names included in this conversion. - `table_count?: number | null` Number of tables extracted from the workbook. Only present when status is 'completed'. ### Example ```typescript import DeepTable from '@deeptable/deeptable'; const client = new DeepTable({ apiKey: process.env['DEEPTABLE_API_KEY'], // This is the default and can be omitted }); const structuredSheetResponse = await client.structuredSheets.cancel( 'ss_01kfxgjd94fn9stqm42nejb627', ); console.log(structuredSheetResponse.id); ``` #### Response ```json { "id": "ss_01kfxgjd94fn9stqm42nejb627", "created_at": "2024-01-15T10:30:00Z", "file_id": "file_01kfxgjd94fn9stqm414vjb0s8", "object": "structured_sheet", "status": "completed", "updated_at": "2024-01-15T10:35:00Z", "last_error": { "code": "invalid_file_format", "message": "The uploaded file is not a valid Excel spreadsheet." }, "sheet_names": [ "Sheet1", "Financials" ], "table_count": 6 } ``` ## Download structured sheet export `client.structuredSheets.download(stringstructuredSheetID, StructuredSheetDownloadParamsquery?, RequestOptionsoptions?): Response` **get** `/v1/structured-sheets/{structured_sheet_id}/download` Download the structured data in the specified format. Only available when conversion status is 'completed'. Available formats: - `sqlite`: SQLite database containing all extracted tables - `cell_labels`: CSV file with cell-level semantic labels ### Parameters - `structuredSheetID: string` The unique identifier of the structured sheet conversion. - `query: StructuredSheetDownloadParams` - `format?: "sqlite" | "cell_labels"` The export format to download. - `"sqlite"` - `"cell_labels"` ### Returns - `unnamed_schema_4 = Response` ### Example ```typescript import DeepTable from '@deeptable/deeptable'; const client = new DeepTable({ apiKey: process.env['DEEPTABLE_API_KEY'], // This is the default and can be omitted }); const response = await client.structuredSheets.download('ss_01kfxgjd94fn9stqm42nejb627'); console.log(response); const content = await response.blob(); console.log(content); ``` ## Domain Types ### Structured Sheet Response - `StructuredSheetResponse` Response representing a structured sheet conversion job. This is returned from POST (create), GET (retrieve), and list endpoints. - `id: string` The unique identifier for this structured sheet conversion. - `created_at: string` The timestamp when the conversion was started. - `file_id: string` The unique identifier for the source file. - `object: "structured_sheet"` The object type, which is always 'structured_sheet'. - `"structured_sheet"` - `status: "queued" | "in_progress" | "completed" | 2 more` The current processing status. - `"queued"` - `"in_progress"` - `"completed"` - `"failed"` - `"cancelled"` - `updated_at: string` The timestamp when the conversion was last updated. - `last_error?: LastError | null` Error information when processing fails. - `code: string` A machine-readable error code. - `message: string` A human-readable description of the error. - `sheet_names?: Array` List of sheet names included in this conversion. - `table_count?: number | null` Number of tables extracted from the workbook. Only present when status is 'completed'. # Tables ## List tables in structured sheet `client.structuredSheets.tables.list(stringstructuredSheetID, TableListParamsquery?, RequestOptionsoptions?): CursorIDPage` **get** `/v1/structured-sheets/{structured_sheet_id}/tables` List all tables extracted from the structured sheet. Only available when conversion status is 'completed'. ### Parameters - `structuredSheetID: string` The unique identifier of the structured sheet conversion. - `query: TableListParams` - `after?: string | null` A cursor for pagination. Use the `last_id` from a previous response to fetch the next page of results. - `limit?: number` Maximum number of tables to return per page. ### Returns - `TableResponse` Response representing a table extracted from a structured sheet. This is returned from GET (retrieve) and list table endpoints. Table names use a composite format: {normalized_sheet_name}__{table_name}. - `id: string` The unique identifier for this table. - `created_at: string` The timestamp when this table was created. - `name: string` Composite table name: {normalized_sheet_name}__{table_name}. Uses lowercase snake_case. Aggregation tables end with '__aggregations'. Two special metadata tables exist per structured sheet: '__deeptable_workbook_metadata' (workbook provenance info) and '__deeptable_table_overview' (summary of all tables). Example: 'staffing__head_count' or 'staffing__head_count__aggregations'. - `object: "table"` The object type, which is always 'table'. - `"table"` - `sheet_name: string` The original Excel sheet name this table came from. - `structured_sheet_id: string` The ID of the structured sheet this table belongs to. - `type: "relational" | "aggregation" | "tableless" | "metadata"` The type of table (relational, aggregation, tableless, or metadata). - `"relational"` - `"aggregation"` - `"tableless"` - `"metadata"` ### Example ```typescript import DeepTable from '@deeptable/deeptable'; const client = new DeepTable({ apiKey: process.env['DEEPTABLE_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const tableResponse of client.structuredSheets.tables.list( 'ss_01kfxgjd94fn9stqm42nejb627', )) { console.log(tableResponse.id); } ``` #### Response ```json { "data": [ { "id": "tbl_01kfxgjd94fn9stqm45rqr2pnz", "created_at": "2026-01-15T10:35:00Z", "name": "staffing__head_count", "object": "table", "sheet_name": "Staffing", "structured_sheet_id": "ss_01kfxgjd94fn9stqm42nejb627", "type": "relational" }, { "id": "tbl_02abc2def3ghjkmnpqrs4uvwxz", "created_at": "2026-01-15T10:35:00Z", "name": "staffing__head_count__aggregations", "object": "table", "sheet_name": "Staffing", "structured_sheet_id": "ss_01kfxgjd94fn9stqm42nejb627", "type": "aggregation" } ], "has_more": false, "object": "list", "first_id": "tbl_01kfxgjd94fn9stqm45rqr2pnz", "last_id": "tbl_02abc2def3ghjkmnpqrs4uvwxz" } ``` ## Retrieve a table `client.structuredSheets.tables.retrieve(stringtableID, TableRetrieveParamsparams, RequestOptionsoptions?): TableResponse` **get** `/v1/structured-sheets/{structured_sheet_id}/tables/{table_id}` Get details of a specific table extracted from the structured sheet. Only available when conversion status is 'completed'. ### Parameters - `tableID: string` The unique identifier of the table. - `params: TableRetrieveParams` - `structured_sheet_id: string` The unique identifier of the structured sheet conversion. ### Returns - `TableResponse` Response representing a table extracted from a structured sheet. This is returned from GET (retrieve) and list table endpoints. Table names use a composite format: {normalized_sheet_name}__{table_name}. - `id: string` The unique identifier for this table. - `created_at: string` The timestamp when this table was created. - `name: string` Composite table name: {normalized_sheet_name}__{table_name}. Uses lowercase snake_case. Aggregation tables end with '__aggregations'. Two special metadata tables exist per structured sheet: '__deeptable_workbook_metadata' (workbook provenance info) and '__deeptable_table_overview' (summary of all tables). Example: 'staffing__head_count' or 'staffing__head_count__aggregations'. - `object: "table"` The object type, which is always 'table'. - `"table"` - `sheet_name: string` The original Excel sheet name this table came from. - `structured_sheet_id: string` The ID of the structured sheet this table belongs to. - `type: "relational" | "aggregation" | "tableless" | "metadata"` The type of table (relational, aggregation, tableless, or metadata). - `"relational"` - `"aggregation"` - `"tableless"` - `"metadata"` ### Example ```typescript import DeepTable from '@deeptable/deeptable'; const client = new DeepTable({ apiKey: process.env['DEEPTABLE_API_KEY'], // This is the default and can be omitted }); const tableResponse = await client.structuredSheets.tables.retrieve( 'tbl_01kfxgjd94fn9stqm45rqr2pnz', { structured_sheet_id: 'ss_01kfxgjd94fn9stqm42nejb627' }, ); console.log(tableResponse.id); ``` #### Response ```json { "id": "tbl_01kfxgjd94fn9stqm45rqr2pnz", "created_at": "2026-01-15T10:35:00Z", "name": "staffing__head_count", "object": "table", "sheet_name": "Staffing", "structured_sheet_id": "ss_01kfxgjd94fn9stqm42nejb627", "type": "relational" } ``` ## Download table data `client.structuredSheets.tables.download(stringtableID, TableDownloadParamsparams, RequestOptionsoptions?): Response` **get** `/v1/structured-sheets/{structured_sheet_id}/tables/{table_id}/download` Download the table data in the specified format. Available formats: - `parquet`: Apache Parquet columnar format (recommended for data analysis) - `csv`: Comma-separated values (compatible with any spreadsheet application) ### Parameters - `tableID: string` The unique identifier of the table. - `params: TableDownloadParams` - `structured_sheet_id: string` Path param: The unique identifier of the structured sheet conversion. - `format: "parquet" | "csv"` Query param: The format to download the table data in. - `"parquet"` - `"csv"` ### Returns - `unnamed_schema_5 = Response` ### Example ```typescript import DeepTable from '@deeptable/deeptable'; const client = new DeepTable({ apiKey: process.env['DEEPTABLE_API_KEY'], // This is the default and can be omitted }); const response = await client.structuredSheets.tables.download('tbl_01kfxgjd94fn9stqm45rqr2pnz', { structured_sheet_id: 'ss_01kfxgjd94fn9stqm42nejb627', format: 'parquet', }); console.log(response); const content = await response.blob(); console.log(content); ``` ## Domain Types ### Table Response - `TableResponse` Response representing a table extracted from a structured sheet. This is returned from GET (retrieve) and list table endpoints. Table names use a composite format: {normalized_sheet_name}__{table_name}. - `id: string` The unique identifier for this table. - `created_at: string` The timestamp when this table was created. - `name: string` Composite table name: {normalized_sheet_name}__{table_name}. Uses lowercase snake_case. Aggregation tables end with '__aggregations'. Two special metadata tables exist per structured sheet: '__deeptable_workbook_metadata' (workbook provenance info) and '__deeptable_table_overview' (summary of all tables). Example: 'staffing__head_count' or 'staffing__head_count__aggregations'. - `object: "table"` The object type, which is always 'table'. - `"table"` - `sheet_name: string` The original Excel sheet name this table came from. - `structured_sheet_id: string` The ID of the structured sheet this table belongs to. - `type: "relational" | "aggregation" | "tableless" | "metadata"` The type of table (relational, aggregation, tableless, or metadata). - `"relational"` - `"aggregation"` - `"tableless"` - `"metadata"`