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

# Create Sheet

> Create a new sheet in a table by importing data from a file (CSV or JSON, base64-encoded) or from request log history. Requests are scoped to the workspace associated with the API key; table, sheet, column, cell, operation, and version IDs must belong to that workspace.

Create a new sheet in a table by importing data. Two source types are supported:

* **file** — Upload a CSV or JSON file (base64-encoded, max 100 MB). The import runs asynchronously; poll the operation endpoint to track progress.
* **request\_logs** — Import from your PromptLayer request history. Filter by prompt, version, label, or date range.


## OpenAPI

````yaml POST /api/public/v2/tables/{table_id}/sheets
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security:
  - ApiKeyAuth: []
paths:
  /api/public/v2/tables/{table_id}/sheets:
    post:
      tags:
        - smart-tables
      summary: Create Sheet
      description: >-
        Create a new sheet in a table by importing data from a file (CSV or
        JSON, base64-encoded) or from request log history. Requests are scoped
        to the workspace associated with the API key; table, sheet, column,
        cell, operation, and version IDs must belong to that workspace.
      operationId: create_table_sheet
      parameters:
        - name: table_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - source
              properties:
                title:
                  type: string
                  nullable: true
                  description: >-
                    Sheet title. Defaults to the source file name or 'Request
                    Logs'.
                index:
                  type: integer
                  nullable: true
                  description: >-
                    Display position within the table (0-based). Defaults to
                    appending at the end.
                operation_id:
                  type: string
                  nullable: true
                  description: Optional idempotency key for the import operation.
                source:
                  description: Data source for the sheet.
                  oneOf:
                    - type: object
                      title: File source
                      required:
                        - type
                        - file_name
                        - file_content_base64
                      properties:
                        type:
                          type: string
                          enum:
                            - file
                        file_name:
                          type: string
                          description: Original file name (must end in .csv or .json).
                        file_content_base64:
                          type: string
                          description: Base64-encoded file content (max 100 MB).
                    - type: object
                      title: Request logs source
                      required:
                        - type
                      properties:
                        type:
                          type: string
                          enum:
                            - request_logs
                        request_log_ids:
                          type: array
                          items:
                            type: integer
                          nullable: true
                          description: >-
                            Specific request log IDs to import. When omitted,
                            filter params are used.
                        prompt_id:
                          type: integer
                          nullable: true
                        prompt_version_id:
                          type: integer
                          nullable: true
                        prompt_label_id:
                          type: integer
                          nullable: true
                        start_time:
                          type: string
                          format: date-time
                          nullable: true
                        end_time:
                          type: string
                          format: date-time
                          nullable: true
      responses:
        '202':
          description: Import started. Poll the operation endpoint to track progress.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  operation_id:
                    type: string
                  operation:
                    $ref: '#/components/schemas/TableImportOperation'
                  sheet:
                    $ref: '#/components/schemas/Sheet'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          description: Table not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    TableImportOperation:
      type: object
      description: Status of an asynchronous sheet import operation.
      properties:
        operation_id:
          type: string
        source:
          type: string
          enum:
            - file
            - request_logs
        status:
          type: string
          enum:
            - pending
            - running
            - completed
            - failed
        progress:
          type: number
          nullable: true
        message:
          type: string
          nullable: true
        rows_added:
          type: integer
          nullable: true
        row_count:
          type: integer
          nullable: true
        file_name:
          type: string
          nullable: true
        error_message:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
          nullable: true
        updated_at:
          type: string
          format: date-time
          nullable: true
    Sheet:
      type: object
      description: A sheet within a Table.
      properties:
        id:
          type: string
          format: uuid
        table_id:
          type: string
          format: uuid
        workspace_id:
          type: integer
          description: >-
            Workspace that owns this resource; determined by the authenticated
            request scope.
        title:
          type: string
        index:
          type: integer
          description: Display order of the sheet within the table (0-based).
        row_count:
          type: integer
        version_count:
          type: integer
          description: >-
            Current sheet version number. It increments when sheet data, layout,
            score configuration, imports, or execution output changes.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          default: false
          description: Indicates that the request failed.
        message:
          type: string
          description: Human-readable error message.
        error:
          type: string
          description: Machine-readable or fallback error message.
      additionalProperties: true
      description: >-
        Standard error response. Some legacy endpoints may return either message
        or error.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  responses:
    UnauthorizedError:
      description: Unauthorized - missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ValidationError:
      description: Validation error - request parameters or body are invalid.
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/HTTPValidationError'
              - $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````