# Add or Update Row — Orca Scan

> Adds a new row or updates an existing row in a sheet. See the documentation

- Key: `orca_scan-add-update-row`
- Type: Action (Write)
- Version: 0.0.2
- App: Orca Scan (`orca_scan`) — https://pipedream.com/apps/orca-scan.md
- This page (HTML): https://pipedream.com/apps/orca-scan/actions/add-update-row
- Hints: destructive · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/orca_scan/actions/add-update-row/add-update-row.mjs

## Description

Adds a new row or updates an existing row in a sheet. [See the documentation](https://orcascan.com/guides/add-barcode-tracking-to-your-system-using-a-rest-api-f09a21c3)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `sheetId` | `string` | Yes | The ID of the sheet where the row will be created or updated. Options are loaded from the connected account. |
| `rowData` | `object` | Yes | The data for the new row to be added or updated. To get the fields, use the Find Row action to find a row and refer to the JSON output. |
| `barcode` | `string` | No | The barcode value to locate a specific row record. If the barcode is not found, a new row will be created. If the barcode is found, the row will be updated with the data in Row Data. |

## 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": "orca_scan",
      },
    },
  },
)

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: "orca_scan-add-update-row",
  arguments: {
    sheetId: "Sheet ID",
    rowData: "Row Data",
  },
})
```

**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: "orca_scan-add-update-row",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    orca_scan: { authProvisionId: "apn_xxxxxxx" },
    sheetId: "Sheet ID",
    rowData: "Row Data",
  },
})

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": "orca_scan-add-update-row",
    "configured_props": {
      "orca_scan": { "authProvisionId": "apn_xxxxxxx" },
      "sheetId": "Sheet ID",
      "rowData": "Row Data"
    }
  }'
```

---

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