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

# Upload a new workbook

> Upload an Excel workbook file and make it available in the API.

The workbook will be processed in the background. Once it's processed successfully it will be
available for querying and exporting.



## OpenAPI

````yaml post /v1/workbooks
openapi: 3.1.0
info:
  title: GRID API
  summary: Spreadsheets run the world. Now you can run spreadsheets.
  description: >-
    GRID's API transforms spreadsheets into powerful, programmable APIs. Our
    platform supports seamless integration of spreadsheet data into your
    applications, supporting dynamic interactions with spreadsheets, including
    real-time data querying with ephemeral updates.
  version: 1.0.0
servers:
  - url: https://api.grid.is
security: []
tags:
  - name: workbooks
    description: Interact with workbooks and their data
paths:
  /v1/workbooks:
    post:
      tags:
        - workbooks
      summary: Upload a new workbook
      description: >-
        Upload an Excel workbook file and make it available in the API.


        The workbook will be processed in the background. Once it's processed
        successfully it will be

        available for querying and exporting.
      operationId: upload_workbook
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_workbook'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadWorkbookResponse'
        '400':
          description: Error returned when you make a bad request
          content:
            application/json:
              example:
                error_code: invalid_json
                error_message: Bad request
                error_details: RequestJsonParsingFailed
        '403':
          description: Error returned when you don't have permission to query a workbook
          content:
            application/json:
              example:
                error_message: Forbidden
                error_details: Only API keys can access the workbook engine API
        '429':
          description: Error returned when you exceed your API rate limit
          content:
            application/json:
              example:
                error_code: rate_limit_exceeded
                error_message: Rate limit exceeded
                error_details: 'Retry after: 60'
      security:
        - apiKey: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Grid from '@grid-is/api';


            const client = new Grid({
              apiKey: 'My API Key',
            });


            const response = await client.workbooks.upload({ file:
            fs.createReadStream('path/to/file') });


            console.log(response.id);
        - lang: Python
          source: |-
            from grid_api import Grid

            client = Grid(
                api_key="My API Key",
            )
            response = client.workbooks.upload(
                file=b"raw file contents",
            )
            print(response.id)
        - lang: Java
          source: |-
            package is.grid.api.example;

            import is.grid.api.client.GridClient;
            import is.grid.api.client.okhttp.GridOkHttpClient;
            import is.grid.api.models.workbooks.WorkbookUploadParams;
            import is.grid.api.models.workbooks.WorkbookUploadResponse;
            import java.io.ByteArrayInputStream;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    GridClient client = GridOkHttpClient.fromEnv();

                    WorkbookUploadParams params = WorkbookUploadParams.builder()
                        .file(ByteArrayInputStream("some content".getBytes()))
                        .build();
                    WorkbookUploadResponse response = client.workbooks().upload(params);
                }
            }
components:
  schemas:
    Body_upload_workbook:
      properties:
        file:
          type: string
          format: binary
          title: File
          description: Excel (.xlsx) file
          content_type: application/octet-stream
      type: object
      required:
        - file
      title: Body_upload_workbook
    UploadWorkbookResponse:
      properties:
        id:
          type: string
          title: Id
          description: The id of the newly uploaded workbook
      type: object
      required:
        - id
      title: UploadWorkbookResponse
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: JWT

````