> ## Documentation Index
> Fetch the complete documentation index at: https://help.teable.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Post import

> create table from file



## OpenAPI

````yaml /swagger.json post /import/{baseId}
openapi: 3.0.0
info:
  version: 1.0.0
  title: Teable App
  description: Manage Data as easy as drink a cup of tea
  x-logo:
    backgroundColor: '#F0F0F0'
    altText: Teable logo
servers:
  - url: https://app.teable.ai/api
security: []
paths:
  /import/{baseId}:
    post:
      tags:
        - import
      description: create table from file
      parameters:
        - schema:
            type: string
          required: true
          name: baseId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                worksheets:
                  type: object
                  additionalProperties:
                    type: object
                    properties:
                      name:
                        type: string
                      columns:
                        type: array
                        items:
                          type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - singleLineText
                                - longText
                                - user
                                - attachment
                                - checkbox
                                - multipleSelect
                                - singleSelect
                                - date
                                - number
                                - rating
                                - formula
                                - rollup
                                - conditionalRollup
                                - link
                                - createdTime
                                - lastModifiedTime
                                - createdBy
                                - lastModifiedBy
                                - autoNumber
                                - button
                            name:
                              type: string
                            sourceColumnIndex:
                              type: number
                          required:
                            - type
                            - name
                            - sourceColumnIndex
                      useFirstRowAsHeader:
                        type: boolean
                      importData:
                        type: boolean
                    required:
                      - name
                      - columns
                      - useFirstRowAsHeader
                      - importData
                attachmentUrl:
                  type: string
                fileType:
                  type: string
                  enum:
                    - csv
                    - excel
                notification:
                  type: boolean
                tz:
                  type: string
                  description: The time zone that should be used to format dates
              required:
                - worksheets
                - attachmentUrl
                - fileType
                - tz
      responses:
        '201':
          description: Returns data about a table without records
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The id of table.
                  name:
                    type: string
                    description: The name of the table.
                  dbTableName:
                    type: string
                    pattern: ^[a-z]\w{0,62}$/i
                    description: >-
                      Table name in backend database. Limitation: 1-63
                      characters, start with letter, can only contain letters,
                      numbers and underscore, case insensitive, cannot be
                      duplicated with existing db table name in the base.
                  description:
                    type: string
                    description: The description of the table.
                  icon:
                    type: string
                    format: emoji
                    description: The emoji icon string of the table.
                  order:
                    type: number
                  lastModifiedTime:
                    type: string
                    description: The last modified time of the table.
                  defaultViewId:
                    type: string
                    description: The default view id of the table.
                required:
                  - id
                  - name
                  - dbTableName
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: Shell
          source: |-
            curl --request POST \
              --url https://app.teable.ai/api/import/%7BbaseId%7D \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"worksheets":{"property1":{"name":"string","columns":[{"type":"singleLineText","name":"string","sourceColumnIndex":0}],"useFirstRowAsHeader":true,"importData":true},"property2":{"name":"string","columns":[{"type":"singleLineText","name":"string","sourceColumnIndex":0}],"useFirstRowAsHeader":true,"importData":true}},"attachmentUrl":"string","fileType":"csv","notification":true,"tz":"string"}'
        - lang: JavaScript
          source: |-
            const url = 'https://app.teable.ai/api/import/%7BbaseId%7D';
            const options = {
              method: 'POST',
              headers: {
                Authorization: 'Bearer REPLACE_BEARER_TOKEN',
                'content-type': 'application/json'
              },
              body: '{"worksheets":{"property1":{"name":"string","columns":[{"type":"singleLineText","name":"string","sourceColumnIndex":0}],"useFirstRowAsHeader":true,"importData":true},"property2":{"name":"string","columns":[{"type":"singleLineText","name":"string","sourceColumnIndex":0}],"useFirstRowAsHeader":true,"importData":true}},"attachmentUrl":"string","fileType":"csv","notification":true,"tz":"string"}'
            };

            try {
              const response = await fetch(url, options);
              const data = await response.json();
              console.log(data);
            } catch (error) {
              console.error(error);
            }
        - lang: Node.js
          source: |-
            const http = require('https');

            const options = {
              method: 'POST',
              hostname: 'app.teable.ai',
              port: null,
              path: '/api/import/%7BbaseId%7D',
              headers: {
                Authorization: 'Bearer REPLACE_BEARER_TOKEN',
                'content-type': 'application/json'
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on('data', function (chunk) {
                chunks.push(chunk);
              });

              res.on('end', function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.write(JSON.stringify({
              worksheets: {
                property1: {
                  name: 'string',
                  columns: [{type: 'singleLineText', name: 'string', sourceColumnIndex: 0}],
                  useFirstRowAsHeader: true,
                  importData: true
                },
                property2: {
                  name: 'string',
                  columns: [{type: 'singleLineText', name: 'string', sourceColumnIndex: 0}],
                  useFirstRowAsHeader: true,
                  importData: true
                }
              },
              attachmentUrl: 'string',
              fileType: 'csv',
              notification: true,
              tz: 'string'
            }));
            req.end();
        - lang: Python
          source: >-
            import http.client


            conn = http.client.HTTPSConnection("app.teable.ai")


            payload =
            "{\"worksheets\":{\"property1\":{\"name\":\"string\",\"columns\":[{\"type\":\"singleLineText\",\"name\":\"string\",\"sourceColumnIndex\":0}],\"useFirstRowAsHeader\":true,\"importData\":true},\"property2\":{\"name\":\"string\",\"columns\":[{\"type\":\"singleLineText\",\"name\":\"string\",\"sourceColumnIndex\":0}],\"useFirstRowAsHeader\":true,\"importData\":true}},\"attachmentUrl\":\"string\",\"fileType\":\"csv\",\"notification\":true,\"tz\":\"string\"}"


            headers = {
                'Authorization': "Bearer REPLACE_BEARER_TOKEN",
                'content-type': "application/json"
            }


            conn.request("POST", "/api/import/%7BbaseId%7D", payload, headers)


            res = conn.getresponse()

            data = res.read()


            print(data.decode("utf-8"))
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````