# Move Rows — Smartsheet

> Move rows from one sheet to another. WARNING: the rows are permanently removed from the source sheet. Cell values and formatting always come across; attachments and comments only if you ask for them via Include. Columns the destination…

- Key: `smartsheet-move-rows`
- Type: Action (Write)
- Version: 0.1.1
- App: Smartsheet (`smartsheet`) — https://pipedream.com/apps/smartsheet.md
- This page (HTML): https://pipedream.com/apps/smartsheet/actions/move-rows
- Hints: destructive · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/smartsheet/actions/move-rows/move-rows.mjs

## Description

Move rows from one sheet to another. WARNING: the rows are permanently removed from the source sheet. Cell values and formatting always come across; attachments and comments only if you ask for them via Include. Columns the destination sheet is missing are created automatically, so it does not have to match the source first. Returns `rowMappings` pairing each source row ID with its new ID in the destination. To keep the originals, use **Copy Rows**. [See the documentation](https://developers.smartsheet.com/api/smartsheet/openapi/rows/move-rows)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `sheetId` | `string` | Yes | The sheet the rows are moved out of. Accepts a numeric sheet ID (e.g. 1234567890123456), or a Smartsheet sheet URL, which is resolved to the ID for you. Use List Sheets to enumerate sheets, or Search to find one by name. |
| `rowIds` | `string` | Yes | Comma-separated list of row IDs to move, or a JSON array. Example: 1234567890, 9876543210 or [1234567890, 9876543210]. Use Get Sheet to find row IDs. |
| `destinationSheetId` | `string` | Yes | The sheet the rows are moved into. Accepts a numeric sheet ID (e.g. 1234567890123456), or a Smartsheet sheet URL, which is resolved to the ID for you. Use List Sheets to enumerate sheets, or Search to find one by name. |
| `include` | `string[]` | No | Extra elements to carry across. Without this, only cell values and formatting are moved; attachments and comments are not. Move Rows supports only attachments and discussions - the children and all values that Copy Rows accepts are not available for this endpoint. |
| `ignoreRowsNotFound` | `boolean` | No | true to skip row IDs that do not exist in the source sheet. Default false, which fails the whole call with a 404 if any ID is missing. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "smartsheet",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "smartsheet-move-rows",
  arguments: {
    sheetId: "Source Sheet ID or URL",
    rowIds: "Row IDs",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "smartsheet-move-rows",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    smartsheet: { authProvisionId: "apn_xxxxxxx" },
    sheetId: "Source Sheet ID or URL",
    rowIds: "Row IDs",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "smartsheet-move-rows",
    "configured_props": {
      "smartsheet": { "authProvisionId": "apn_xxxxxxx" },
      "sheetId": "Source Sheet ID or URL",
      "rowIds": "Row IDs"
    }
  }'
```

---

- App: https://pipedream.com/apps/smartsheet.md · All apps: https://pipedream.com/apps
