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

# Exportovat tabulku

> Export dat tabulky jako CSV, XLSX, JSON nebo ZIP archiv obrázků.

## Formáty odpovědi

| `format` | Content-Type | Odpověď |
| - | - | - |
| `csv` | `text/csv` | Soubor CSV |
| `xlsx` | `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` | Sešit Excel |
| `json` | `application/json` | Pole JSON s objekty řádků |
| `images` | `application/zip` | Archiv ZIP s exportovanými obrázky |

Před exportem musí být tabulka dokončená. Parametr `columns` odešlete jako seznam klíčů sloupců oddělený čárkami. Všechny odpovědi jiné než JSON zpracujte jako bajty a při ukládání zachovejte název souboru z `Content-Disposition`.

> [!WARNING]
>
> Pomocné metody TypeScript SDK pro `csv`, `xlsx` a `images` a metoda Python SDK pro `csv` se nyní pokoušejí odpověď zpracovat jako JSON. Pro tyto formáty použijte přímé HTTP. Metody Python SDK pro `xlsx` a `images` už vracejí bajty.

## Příklady

```bash cURL theme={null}
curl --request GET \
  --url "https://app.productlasso.com/api/v1/tables/$TABLE_ID/export?format=xlsx&columns=sku,product_name,price" \
  --header "Authorization: Bearer $LASSO_API_KEY" \
  --output products.xlsx
```

```typescript TypeScript theme={null}
import { writeFile } from "node:fs/promises";

const tableId = "YOUR_TABLE_ID";
const params = new URLSearchParams({
  format: "xlsx",
  columns: "sku,product_name,price",
});
const response = await fetch(
  `https://app.productlasso.com/api/v1/tables/${tableId}/export?${params}`,
  { headers: { Authorization: `Bearer ${process.env.LASSO_API_KEY}` } },
);

if (!response.ok) throw new Error(await response.text());
await writeFile("products.xlsx", Buffer.from(await response.arrayBuffer()));
```

```python Python theme={null}
import os
import requests

table_id = "YOUR_TABLE_ID"
response = requests.get(
    f"https://app.productlasso.com/api/v1/tables/{table_id}/export",
    headers={"Authorization": f"Bearer {os.environ['LASSO_API_KEY']}"},
    params={"format": "xlsx", "columns": "sku,product_name,price"},
    timeout=120,
)
response.raise_for_status()

with open("products.xlsx", "wb") as file:
    file.write(response.content)
```

## Obsah šablon

CSV, XLSX a JSON převádějí strukturované popisy ze šablon na HTML podle nastavení exportu sloupce. Běžný export odstraňuje skripty a obsluhu událostí. CSV export Catalog má jiné chování: popisy jsou prostý text.

XLSX odmítne popis delší než 32 767 znaků v buňce místo jeho zkrácení. Pro delší obsah použijte CSV nebo JSON. Viz [Šablony obsahu](https://productlasso.com/docs/cs/learn/content-templates.md) pro režimy stylování a ověření importu.


## OpenAPI

````yaml openapi.yaml GET /tables/{table_id}/export
openapi: 3.1.0
info:
  title: Lasso API
  description: AI-powered product data extraction and enhancement API
  version: 1.0.0
  contact:
    name: Lasso Support
    url: https://lasso.ai
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://app.productlasso.com/api/v1
    description: Production
security:
  - BearerAuth: []
paths:
  /tables/{table_id}/export:
    parameters:
      - name: table_id
        in: path
        required: true
        schema:
          type: string
    get:
      tags:
        - Export
      summary: Export table data
      operationId: exportTable
      parameters:
        - name: format
          in: query
          required: true
          schema:
            type: string
            enum:
              - csv
              - xlsx
              - json
              - images
        - name: columns
          in: query
          schema:
            type: string
          description: Comma-separated column keys to include. Omit for all columns.
      responses:
        '200':
          description: Exported file
          content:
            text/csv:
              schema:
                type: string
                format: binary
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
            application/json:
              schema:
                type: array
                items:
                  type: object
            application/zip:
              schema:
                type: string
                format: binary
        '404':
          $ref: '#/components/responses/NotFound'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |
            curl --request GET \
              --url "https://app.productlasso.com/api/v1/tables/$TABLE_ID/export?format=xlsx&columns=sku,product_name,price" \
              --header "Authorization: Bearer $LASSO_API_KEY" \
              --output products.xlsx
        - lang: typescript
          label: TypeScript
          source: >
            import { writeFile } from "node:fs/promises";


            const tableId = "YOUR_TABLE_ID";

            const params = new URLSearchParams({
              format: "xlsx",
              columns: "sku,product_name,price",
            });

            const response = await fetch(
              `https://app.productlasso.com/api/v1/tables/${tableId}/export?${params}`,
              { headers: { Authorization: `Bearer ${process.env.LASSO_API_KEY}` } },
            );


            if (!response.ok) throw new Error(await response.text());

            await writeFile("products.xlsx", Buffer.from(await
            response.arrayBuffer()));
        - lang: python
          label: Python
          source: |
            import os
            import requests

            table_id = "YOUR_TABLE_ID"
            response = requests.get(
                f"https://app.productlasso.com/api/v1/tables/{table_id}/export",
                headers={"Authorization": f"Bearer {os.environ['LASSO_API_KEY']}"},
                params={"format": "xlsx", "columns": "sku,product_name,price"},
                timeout=120,
            )
            response.raise_for_status()

            with open("products.xlsx", "wb") as file:
                file.write(response.content)
components:
  responses:
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - status_code
        - error_type
        - message
        - request_id
      properties:
        status_code:
          type: integer
        error_type:
          type: string
          enum:
            - invalid_request
            - unauthenticated
            - forbidden
            - not_found
            - conflict
            - validation_error
            - rate_limited
            - service_unavailable
            - internal_error
        message:
          type: string
        request_id:
          type: string
        code:
          type: string
          description: >-
            Stable machine-readable detail code for validation, conflict, and
            retryable availability errors.
        retryable:
          type: boolean
          description: Whether the request can be retried without changing its payload.
        attribute_id:
          type: string
          format: uuid
          description: Stable Attribute identity when the error is scoped to one Attribute.
        attribute_key:
          type: string
          description: Attribute key when the error is scoped to one Attribute.
        details:
          type: object
          additionalProperties: true
        current_updated_at:
          type: string
          format: date-time
          description: >-
            Current resource revision supplied for client-directed refetch after
            a stale write.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.