# Rows Integration via LowCodeAPI

## Overview

Rows is a modern spreadsheet software that combines the power of spreadsheets with the ability to integrate data from various sources. The Rows API provides functionality for:

- **Spreadsheets** - Create, read, and update spreadsheets
- **Tables** - Manage tables within spreadsheets
- **Data Values** - Read and write cell values and ranges
- **Workspaces** - Organize and manage spreadsheet workspaces

## Base Endpoint

```
https://api.lowcodeapi.com/rows/
```

## Authentication

LowCodeAPI handles authentication automatically using Bearer token authentication. You only need to:

1. **Sign up** at [Rows](https://rows.com) to get your API Key
2. **Connect your account** in the LowCodeAPI dashboard
3. **Use your `api_token`** in all requests

The `api_token` is your LowCodeAPI authentication token. LowCodeAPI will automatically:
- Fetch your Rows API key
- Apply it to each request as a Bearer token

**Auth Type**: Bearer Token

## API Categories

- **Utilities** - Spreadsheet and data management

## Common Endpoints

### Category: Spreadsheet

#### Get Spreadsheet Information

**Method**: `GET` | **LowCodeAPI Path**: `/v1beta1/spreadsheets/spreadsheet_id`

**Full URL**:
```
https://api.lowcodeapi.com/rows/v1beta1/spreadsheets/spreadsheet_id?id={spreadsheet_id}&api_token={api_token}
```

**Description**: Retrieve detailed information about a specific spreadsheet.

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `id` | string | Yes | Spreadsheet unique identifier (e.g., 5HGcWJFcQVVAv4mNTYb2RS) |

**Example Request**:
```bash
# Replace SPREADSHEET_ID with actual spreadsheet ID
curl -X GET "https://api.lowcodeapi.com/rows/v1beta1/spreadsheets/spreadsheet_id?id=SPREADSHEET_ID&api_token=YOUR_API_TOKEN"
```

**Official Documentation**: [Get Spreadsheet](https://developers.rows.com/#tag/Spreadsheet)

---

### Category: Tables

#### Get Table Values

**Method**: `GET` | **LowCodeAPI Path**: `/v1beta1/spreadsheets/spreadsheet_id/tables/table_id/values/range`

**Full URL**:
```
https://api.lowcodeapi.com/rows/v1beta1/spreadsheets/spreadsheet_id/tables/table_id/values/range?spreadsheet_id={spreadsheet_id}&table_id={table_id}&range={range}&api_token={api_token}
```

**Description**: Retrieve values from a specific range in a table.

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `spreadsheet_id` | string | Yes | Spreadsheet unique identifier |
| `table_id` | string | Yes | Table identifier within the spreadsheet |
| `range` | string | Yes | Cell range to retrieve (e.g., "A1:Z100") |
| `value_render_option` | string | No | Choose between "FORMATTED" or "RAW" display values (default: "FORMATTED") |
| `major_dimension` | string | No | Choose between "ROW" or "COLUMN" grouping (default: "ROW") |

**Example Request**:
```bash
# Replace SPREADSHEET_ID and TABLE_ID with actual IDs
curl -X GET "https://api.lowcodeapi.com/rows/v1beta1/spreadsheets/spreadsheet_id/tables/table_id/values/range?spreadsheet_id=SPREADSHEET_ID&table_id=TABLE_ID&range=A1:Z100&api_token=YOUR_API_TOKEN"
```

**Official Documentation**: [Get Values](https://developers.rows.com/#tag/Table)

---

#### Update Table Values

**Method**: `PUT` | **LowCodeAPI Path**: `/v1beta1/spreadsheets/spreadsheet_id/tables/table_id/values`

**Full URL**:
```
https://api.lowcodeapi.com/rows/v1beta1/spreadsheets/spreadsheet_id/tables/table_id/values?spreadsheet_id={spreadsheet_id}&table_id={table_id}&api_token={api_token}
```

**Description**: Update values in a table.

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `spreadsheet_id` | string | Yes | Spreadsheet unique identifier |
| `table_id` | string | Yes | Table identifier within the spreadsheet |

**Request Body**:
```json
{
  "values": [
    ["Name", "Email", "Phone"],
    ["John Doe", "[email protected]", "+1234567890"],
    ["Jane Smith", "[email protected]", "+0987654321"]
  ],
  "range": "A1:C3"
}
```

**Request Body Fields**:

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `values` | array | Yes | 2D array of values to write |
| `range` | string | No | Target range for the values |

**Example Request**:
```bash
# Replace SPREADSHEET_ID and TABLE_ID with actual IDs
curl -X PUT "https://api.lowcodeapi.com/rows/v1beta1/spreadsheets/spreadsheet_id/tables/table_id/values?spreadsheet_id=SPREADSHEET_ID&table_id=TABLE_ID&api_token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "values": [
      ["Name", "Email", "Phone"],
      ["John Doe", "[email protected]", "+1234567890"],
      ["Jane Smith", "[email protected]", "+0987654321"]
    ],
    "range": "A1:C3"
  }'
```

**Official Documentation**: [Update Values](https://developers.rows.com/#tag/Table)

---

### Category: Workspace

#### List Spreadsheets

**Method**: `GET` | **LowCodeAPI Path**: `/v1beta1/spreadsheets`

**Full URL**:
```
https://api.lowcodeapi.com/rows/v1beta1/spreadsheets?api_token={api_token}
```

**Description**: Retrieve all spreadsheets in your workspace.

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `page_size` | integer | No | Number of results per page |
| `page_token` | string | No | Token for pagination |

**Example Request**:
```bash
curl -X GET "https://api.lowcodeapi.com/rows/v1beta1/spreadsheets?page_size=50&api_token=YOUR_API_TOKEN"
```

**Official Documentation**: [List Spreadsheets](https://developers.rows.com/#tag/Workspace)

---

## Usage Examples

### Example 1: Read Spreadsheet Data

Read data from a spreadsheet:

```bash
# Step 1: Get spreadsheet information
# Replace SPREADSHEET_ID with actual spreadsheet ID
curl -X GET "https://api.lowcodeapi.com/rows/v1beta1/spreadsheets/spreadsheet_id?id=SPREADSHEET_ID&api_token=YOUR_API_TOKEN"

# Step 2: Read values from a specific table and range
# Replace SPREADSHEET_ID and TABLE_ID with actual IDs
curl -X GET "https://api.lowcodeapi.com/rows/v1beta1/spreadsheets/spreadsheet_id/tables/table_id/values/range?spreadsheet_id=SPREADSHEET_ID&table_id=TABLE_ID&range=A1:Z100&value_render_option=FORMATTED&api_token=YOUR_API_TOKEN"
```

### Example 2: Update Spreadsheet Data

Write data to a spreadsheet:

```bash
# Update values in a table
# Replace SPREADSHEET_ID and TABLE_ID with actual IDs
curl -X PUT "https://api.lowcodeapi.com/rows/v1beta1/spreadsheets/spreadsheet_id/tables/table_id/values?spreadsheet_id=SPREADSHEET_ID&table_id=TABLE_ID&api_token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "values": [
      ["Product", "Price", "Quantity"],
      ["Widget A", "19.99", "100"],
      ["Widget B", "29.99", "50"]
    ],
    "range": "A1:C3"
  }'
```

### Example 3: Browse Workspace

List all spreadsheets in your workspace:

```bash
# Get all spreadsheets with pagination
# No ID needed - lists all spreadsheets
curl -X GET "https://api.lowcodeapi.com/rows/v1beta1/spreadsheets?page_size=100&api_token=YOUR_API_TOKEN"

# Get raw values instead of formatted
# Replace SPREADSHEET_ID and TABLE_ID with actual IDs
curl -X GET "https://api.lowcodeapi.com/rows/v1beta1/spreadsheets/spreadsheet_id/tables/table_id/values/range?spreadsheet_id=SPREADSHEET_ID&table_id=TABLE_ID&range=A1:Z100&value_render_option=RAW&major_dimension=COLUMN&api_token=YOUR_API_TOKEN"
```

## Complete Endpoint Reference

For a complete list of all 8 endpoints and their parameters, refer to:

- **OpenAPI Definition**: https://backend.lowcodeapi.com/rows/definition
- **Official Rows Documentation**: https://developers.rows.com

## Rate Limits & Best Practices

- **Rate Limit**: Refer to your Rows plan for rate limits
- **Best Practices**:
  - Store spreadsheet and table IDs for efficient data access
  - Use appropriate range specifications to avoid unnecessary data transfer
  - Choose the right value render option (FORMATTED vs RAW) based on your use case
  - Batch updates when possible to reduce API calls
  - Implement pagination for large datasets
  - Cache frequently accessed data

## Error Handling

All responses are wrapped in a `data` key:
```json
{
  "data": {
    // Actual response from Rows
  }
}
```

Common errors:
- **400**: Invalid request parameters
- **401**: Invalid API key
- **404**: Spreadsheet or table not found
- **429**: Rate limit exceeded