Skip to content

Latest commit

 

History

History
549 lines (378 loc) · 18.7 KB

File metadata and controls

549 lines (378 loc) · 18.7 KB

SeaTable\Client\ImportExportApi

All URIs are relative to https://cloud.seatable.io, except if the operation defines another base path.

Method HTTP request Description
appendToTableFromFile() POST /api/v2.1/workspace/{workspace_id}/synchronous-import/append-excel-csv-to-table/ Append Excel CSV
exportBase() GET /api/v2.1/workspace/{workspace_id}/synchronous-export/export-dtable/ Export Base
exportBaseFromExternalLink() GET /dtable/external-links/{external_link_token}/download-zip/ Export Base from External Link
exportBigDataView() GET /api/v2.1/workspace/{workspace_id}/dtable/{base_name}/convert-big-data-view-to-excel/ Export Big Data View to Excel
exportTable() GET /api/v2.1/workspace/{workspace_id}/synchronous-export/export-table-to-excel/ Export Table
exportView() GET /api/v2.1/workspace/{workspace_id}/synchronous-export/export-view-to-excel/ Export View
importBasefromDTableFile() POST /api/v2.1/workspace/{workspace_id}/import-dtable/ Import Base from dtable file
importBasefromFile() POST /api/v2.1/workspace/{workspace_id}/synchronous-import/import-excel-csv-to-base/ Import Base from xlsx or csv
importTableFromFile() POST /api/v2.1/workspace/{workspace_id}/synchronous-import/import-excel-csv-to-table/ Import Table from xlsx or csv
updateFromFile() POST /api/v2.1/workspace/{workspace_id}/synchronous-import/update-table-via-excel-csv/ Update from XLSX or CSV

appendToTableFromFile()

appendToTableFromFile($workspace_id, $file, $dtable_uuid, $table_name): object

Append Excel CSV

Appends rows from an uploaded Excel or CSV file to an existing table.

Example

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

// Configure Bearer authorization: AccountTokenAuth (use the right token for your request)
$config = SeaTable\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_TOKEN');
$apiInstance = new SeaTable\Client\User\ImportExportApi(
    new GuzzleHttp\Client(),
    $config
);
$workspace_id = 127; // int | id of your workspace.
$file = '/path/to/file.txt'; // \SplFileObject
$dtable_uuid = 'dtable_uuid_example'; // string | The UUID of the base.
$table_name = 'table_name_example'; // string | The name of the table.

try {
    $result = $apiInstance->appendToTableFromFile($workspace_id, $file, $dtable_uuid, $table_name);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ImportExportApi->appendToTableFromFile: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
workspace_id int id of your workspace.
file \SplFileObject**\SplFileObject** [optional]
dtable_uuid string The UUID of the base. [optional]
table_name string The name of the table. [optional]

Return type

object

Authorization

AccountTokenAuth

exportBase()

exportBase($dtable_name, $workspace_id, $password, $ignore_asset)

Export Base

Export a base as a .dtable file. Optionally exclude assets or provide a base password for encrypted bases.

Example

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

// Configure Bearer authorization: AccountTokenAuth (use the right token for your request)
$config = SeaTable\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_TOKEN');
$apiInstance = new SeaTable\Client\User\ImportExportApi(
    new GuzzleHttp\Client(),
    $config
);
$dtable_name = Example; // string | The name of the base to search for.
$workspace_id = 127; // int | id of your workspace.
$password = 'password_example'; // string | The password of your Base.
$ignore_asset = false; // bool | Set this to `true` to export the base without assets. Default is `false`.

try {
    $apiInstance->exportBase($dtable_name, $workspace_id, $password, $ignore_asset);
} catch (Exception $e) {
    echo 'Exception when calling ImportExportApi->exportBase: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
dtable_name string The name of the base to search for.
workspace_id int id of your workspace.
password string The password of your Base. [optional]
ignore_asset bool Set this to `true` to export the base without assets. Default is `false`. [optional]

Return type

void (empty response body)

Authorization

AccountTokenAuth

exportBaseFromExternalLink()

exportBaseFromExternalLink($external_link_token)

Export Base from External Link

Download a base with its external link as a .dtable zip file. Password protected external links are not supported yet.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new SeaTable\Client\User\ImportExportApi(
    new GuzzleHttp\Client()
);
$external_link_token = f84903f9aa454a2481f3; // string | The token of the external link.

try {
    $apiInstance->exportBaseFromExternalLink($external_link_token);
} catch (Exception $e) {
    echo 'Exception when calling ImportExportApi->exportBaseFromExternalLink: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
external_link_token string The token of the external link.

Return type

void (empty response body)

Authorization

No authorization required

exportBigDataView()

exportBigDataView($workspace_id, $base_name, $table_id, $view_id)

Export Big Data View to Excel

Exports a big data view as an Excel file. Returns a task ID that can be used to track the export progress.

Example

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

// Configure Bearer authorization: AccountTokenAuth (use the right token for your request)
$config = SeaTable\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_TOKEN');
$apiInstance = new SeaTable\Client\User\ImportExportApi(
    new GuzzleHttp\Client(),
    $config
);
$workspace_id = 127; // int | id of your workspace.
$base_name = My Projects; // string | name of your base.
$table_id = 0000; // string | The id of the table. The id of a table is unique inside a base and is often used to identify a table. **Important: the table_id is not the table_name**.
$view_id = Jz4d; // string | id of view, string

try {
    $apiInstance->exportBigDataView($workspace_id, $base_name, $table_id, $view_id);
} catch (Exception $e) {
    echo 'Exception when calling ImportExportApi->exportBigDataView: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
workspace_id int id of your workspace.
base_name string name of your base.
table_id string The id of the table. The id of a table is unique inside a base and is often used to identify a table. Important: the table_id is not the table_name.
view_id string id of view, string

Return type

void (empty response body)

Authorization

AccountTokenAuth

exportTable()

exportTable($table_id, $table_name, $dtable_name, $workspace_id)

Export Table

Export a single table from a base to an Excel file.

Example

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

// Configure Bearer authorization: AccountTokenAuth (use the right token for your request)
$config = SeaTable\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_TOKEN');
$apiInstance = new SeaTable\Client\User\ImportExportApi(
    new GuzzleHttp\Client(),
    $config
);
$table_id = 0000; // string | The id of the table. The id of a table is unique inside a base and is often used to identify a table. **Important: the table_id is not the table_name**.
$table_name = Table1; // string | The name of the table.
$dtable_name = Example; // string | The name of the base to search for.
$workspace_id = 127; // int | id of your workspace.

try {
    $apiInstance->exportTable($table_id, $table_name, $dtable_name, $workspace_id);
} catch (Exception $e) {
    echo 'Exception when calling ImportExportApi->exportTable: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
table_id string The id of the table. The id of a table is unique inside a base and is often used to identify a table. Important: the table_id is not the table_name.
table_name string The name of the table.
dtable_name string The name of the base to search for.
workspace_id int id of your workspace.

Return type

void (empty response body)

Authorization

AccountTokenAuth

exportView()

exportView($table_id, $table_name, $dtable_name, $view_id, $view_name, $workspace_id)

Export View

Export a specific view of a table from a base to an Excel file.

Example

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

// Configure Bearer authorization: AccountTokenAuth (use the right token for your request)
$config = SeaTable\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_TOKEN');
$apiInstance = new SeaTable\Client\User\ImportExportApi(
    new GuzzleHttp\Client(),
    $config
);
$table_id = 0000; // string | The id of the table. The id of a table is unique inside a base and is often used to identify a table. **Important: the table_id is not the table_name**.
$table_name = Table1; // string | The name of the table.
$dtable_name = Example; // string | The name of the base to search for.
$view_id = Jz4d; // string | id of view, string
$view_name = Default View; // string | name of view, required, string
$workspace_id = 127; // int | id of your workspace.

try {
    $apiInstance->exportView($table_id, $table_name, $dtable_name, $view_id, $view_name, $workspace_id);
} catch (Exception $e) {
    echo 'Exception when calling ImportExportApi->exportView: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
table_id string The id of the table. The id of a table is unique inside a base and is often used to identify a table. Important: the table_id is not the table_name.
table_name string The name of the table.
dtable_name string The name of the base to search for.
view_id string id of view, string
view_name string name of view, required, string
workspace_id int id of your workspace.

Return type

void (empty response body)

Authorization

AccountTokenAuth

importBasefromDTableFile()

importBasefromDTableFile($workspace_id, $dtable): \SeaTable\Client\User\ImportBasefromDTableFile200Response

Import Base from dtable file

With this request, you can create a base by uploading a .dtable file.

Example

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

// Configure Bearer authorization: AccountTokenAuth (use the right token for your request)
$config = SeaTable\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_TOKEN');
$apiInstance = new SeaTable\Client\User\ImportExportApi(
    new GuzzleHttp\Client(),
    $config
);
$workspace_id = 127; // int | id of your workspace.
$dtable = '/path/to/file.txt'; // \SplFileObject

try {
    $result = $apiInstance->importBasefromDTableFile($workspace_id, $dtable);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ImportExportApi->importBasefromDTableFile: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
workspace_id int id of your workspace.
dtable \SplFileObject**\SplFileObject** [optional]

Return type

\SeaTable\Client\User\ImportBasefromDTableFile200Response

Authorization

AccountTokenAuth

importBasefromFile()

importBasefromFile($workspace_id, $dtable, $folder): object

Import Base from xlsx or csv

With this request, you can create a base by uploading a .xlsx or a .csv file.

Example

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

// Configure Bearer authorization: AccountTokenAuth (use the right token for your request)
$config = SeaTable\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_TOKEN');
$apiInstance = new SeaTable\Client\User\ImportExportApi(
    new GuzzleHttp\Client(),
    $config
);
$workspace_id = 127; // int | id of your workspace.
$dtable = '/path/to/file.txt'; // \SplFileObject
$folder = 'folder_example'; // string | If you would like to create the base into a folder, give its `folder_id` here. A base is created in the root folder by default. Optional.

try {
    $result = $apiInstance->importBasefromFile($workspace_id, $dtable, $folder);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ImportExportApi->importBasefromFile: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
workspace_id int id of your workspace.
dtable \SplFileObject**\SplFileObject** [optional]
folder string If you would like to create the base into a folder, give its `folder_id` here. A base is created in the root folder by default. Optional. [optional]

Return type

object

Authorization

AccountTokenAuth

importTableFromFile()

importTableFromFile($workspace_id, $file, $dtable_uuid): object

Import Table from xlsx or csv

An XLSX or CSV file can also be imported as a new table in your base. Just select the file and tell SeaTable your base's UUID and the file will be added to that base as a new table. The new table's name will be the filename by default.

Example

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

// Configure Bearer authorization: AccountTokenAuth (use the right token for your request)
$config = SeaTable\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_TOKEN');
$apiInstance = new SeaTable\Client\User\ImportExportApi(
    new GuzzleHttp\Client(),
    $config
);
$workspace_id = 127; // int | id of your workspace.
$file = '/path/to/file.txt'; // \SplFileObject
$dtable_uuid = 'dtable_uuid_example'; // string | The UUID of the base.

try {
    $result = $apiInstance->importTableFromFile($workspace_id, $file, $dtable_uuid);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ImportExportApi->importTableFromFile: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
workspace_id int id of your workspace.
file \SplFileObject**\SplFileObject** [optional]
dtable_uuid string The UUID of the base. [optional]

Return type

object

Authorization

AccountTokenAuth

updateFromFile()

updateFromFile($workspace_id, $file, $dtable_uuid, $table_name, $selected_columns): object

Update from XLSX or CSV

This API call allows you to update a SeaTable database table by uploading an Excel (xlsx) or CSV file. The uploaded file contains rows with data that should be either matched against existing rows in the table for updates or inserted as new rows if no match is found. Matching is performed based on the columns specified in the selected_columns parameter. For each row in the uploaded file, the system checks whether there are existing rows where the values in these selected columns match exactly. If a match is found, the existing row is updated with the new data from the file. If no match exists, the row is added as a new entry. > 📘 Example of the selected_columns parameter > > - If one column is specified (e.g., Name), the update process finds rows where the value in that column matches the corresponding value in the file. Those rows will be updated; unmatched rows result in new rows being created. > - If multiple columns are specified (e.g., Name,Age), all these columns must match exactly for a row to be considered a match and updated. > - Rows not matching on all selected columns are treated as new and will be added to the table.

Example

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

// Configure Bearer authorization: AccountTokenAuth (use the right token for your request)
$config = SeaTable\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_TOKEN');
$apiInstance = new SeaTable\Client\User\ImportExportApi(
    new GuzzleHttp\Client(),
    $config
);
$workspace_id = 127; // int | id of your workspace.
$file = '/path/to/file.txt'; // \SplFileObject
$dtable_uuid = 'dtable_uuid_example'; // string | The UUID of the base.
$table_name = 'table_name_example'; // string | The name of the table.
$selected_columns = 'selected_columns_example'; // string | A list of column names used to determine which rows in the table should be updated or added as new. Separate multiple column names with commas (,).

try {
    $result = $apiInstance->updateFromFile($workspace_id, $file, $dtable_uuid, $table_name, $selected_columns);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ImportExportApi->updateFromFile: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
workspace_id int id of your workspace.
file \SplFileObject**\SplFileObject**
dtable_uuid string The UUID of the base.
table_name string The name of the table.
selected_columns string A list of column names used to determine which rows in the table should be updated or added as new. Separate multiple column names with commas (,).

Return type

object

Authorization

AccountTokenAuth