# Google Sheets Keyed Reconciliation (`apifmcpfactory/sheet-keyed-reconciliation`) Actor

Review exact changes before updating a Google Sheets tab. Match rows by SKU, verify approved writes, and export JSON, CSV or Apify dataset rows.

- **URL**: https://apify.com/apifmcpfactory/sheet-keyed-reconciliation.md
- **Developed by:** [Howth Technology Factory](https://apify.com/apifmcpfactory) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.0045 / actor start

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Google Sheets Keyed Reconciliation

See exactly which cells an import would change before you write to Google Sheets. Match incoming records by SKU or another unique key, review old and new values, then apply the approved changes and check the result.

Use this workflow for recurring inventory, product catalogue or operations updates where the worksheet already contains values you need to preserve. Read one selected table per run. Open the change report for cell references and proposed values, and use the readback to verify the batch.

![Review Google Sheets edits before you write. Actual hosted private preview excerpt · Fictional SKUs.](https://howthtechnologyfactory.pro/assets/sheet-keyed-reconciliation/01-google-sheets.png)

### Try your first preview

1. Choose **Try fictional sample**. Run it without connecting Google.
2. Open `OUTPUT` for the four proposed cell changes across one existing row and one new row. The sample makes no workbook changes.
3. For a real workbook, choose a tab, enter its numeric tab ID and the exact header of your unique key column. Select the table width and enough rows for the current data and expected inserts.
4. Choose **Preview real changes** and supply the incoming records. Open `CHANGES.csv` or the typed report in `OUTPUT`.
5. To write, choose **Apply approved changes** with the same table and inputs. Copy the complete approval object from that preview. Keep one writer active on the table during Apply.
6. Open the readback in `OUTPUT`. If Apply reports that the preview is stale, create a fresh preview and review the differences before trying again.

### Export a tab

Choose **Export table** for a private workbook or **Export an already published tab** for a Google Publish to web CSV link. The published-tab mode uses the displayed text from one already published tab and requires no Google credentials. Enable **Copy exported rows to the run dataset** for header-keyed JSON rows in a restricted Apify dataset.

The hosted published-tab check exported 184 data rows across five columns and matched every dataset value to the JSON export. The built-in sample shows four proposed cell changes and produces a review CSV. In a separate hosted test with a private workbook of fictional inventory, Preview showed six changes, Apply wrote those six cells, and the same approval wrote zero cells on retry. After a later sheet edit, the Actor asked for a fresh preview and the export confirmed the edit was preserved.

### Pricing

Apify charges US$0.0045 per run at up to 1 GB of memory. Each Preview, Apply, retry, sample and export is a separate run. A Preview followed by Apply costs US$0.009 at that memory allocation. Optional dataset rows carry no separate event fee. Review the run cap and current prices in Apify before starting.

### Frequently asked questions

#### 1. What does the unique key do?

It matches an incoming record to one existing row using a column such as SKU. Incoming records with new keys can use blank rows in the selected table.

#### 2. Can I try it without a Google account?

Choose the fictional preview sample to see the change report, or supply a CSV link for an already published Google tab to try export.

#### 3. What kinds of keys are supported?

Use unique text or numbers. Text `0012` keeps its leading zeros and stays distinct from a numeric key.

#### 4. What if a key appears twice?

The preview rejects duplicate keys so you can resolve the ambiguous match before an Apply.

#### 5. What can I use as the incoming data?

Supply JSON records inline or select a readable Apify dataset. The limit is 400 incoming records per preview.

#### 6. Which part of the workbook is selected?

Choose one tab and a table that starts at A1. Row one contains the headers. Select up to 401 rows including the header and up to 30 columns.

#### 7. What if I leave out a field in a record?

An omitted field preserves the existing value. An explicit JSON `null` clears that value.

#### 8. What will the preview show?

For each proposed change, it shows the cell, old value and new value. The approval in `OUTPUT` identifies the exact table and planned changes.

#### 9. Does Preview write to the workbook?

Preview reads the selected table and saves its change plan only in the Apify run.

#### 10. What if someone changes the workbook after my preview?

Apply reads the table again and rejects a stale preview. Use one writer during Apply to avoid concurrent edits during the final read and write.

#### 11. What happens when I apply an approved preview?

The Actor checks the matching input and table, sends one Google batch for the planned cell values and reads back the result.

#### 12. What if there is a formula, generated cell or merge in the planned area?

The preview rejects changes that would overwrite a formula or generated cell or write to a merged cell. Narrow the selected table or change the incoming data.

#### 13. What happens to incoming text that starts with an equals sign?

The Actor writes it as a literal string. Spreadsheet-safe CSV output prefixes formula-like text with an apostrophe.

#### 14. How do I retry after losing my connection during Apply?

Inspect the latest run and its readback first. Use the same approval only for the same table and input. If the readback already matches the approved state, the workflow reports it as already verified.

#### 15. What access does the workbook need to grant?

Use a short-lived access token from an authorised Google OAuth client. The hosted test used the `drive.file` scope on a single workbook already accessible to that client. For Apply, the underlying Google identity must have permission to edit the workbook. Use a disposable tab to try the workflow first. [Google Sheets API scope guidance](https://developers.google.com/workspace/sheets/api/scopes)

#### 16. Where do I enter Google credentials?

Enter your short-lived token in the encrypted **Google OAuth access token** field. Keep credentials out of datasets, inline records and support messages. The input also exposes an advanced service-account field for a dedicated identity shared on the workbook. Use only one credential field per run.

#### 17. Can I export a published tab with no credentials?

Yes. Use its Google Sheets Publish to web CSV URL. The Actor reads the published data and makes no sharing changes.

#### 18. Which export keeps values in their original types?

Use `OUTPUT.values` for private workbook exports. The published CSV mode preserves displayed text as strings.

#### 19. What is included in the exported dataset?

It uses the first row as unique column names and skips blank rows. Computed cells are empty and formula-like text is escaped for use in spreadsheets. The typed JSON retains fuller cell detail.

#### 20. Where does my export go?

The Actor writes JSON and the applicable CSV file to its restricted run store. The optional exported dataset also remains restricted.

#### 21. Can I overwrite or replace the whole tab?

This workflow changes only the cells in a reviewed key-matched plan. Use a separate workflow if you intend to replace an entire sheet.

#### 22. How can I share a problem with support?

Include the run ID, mode and a short description of the affected operation. Remove credentials, private workbook links and cell values from the message. [Howth Technology Factory support](https://howthtechnologyfactory.pro/contact.html)

### See the workflow and output

![See the cells that would change. Actual hosted output excerpt · Fictional SKUs.](https://howthtechnologyfactory.pro/assets/sheet-keyed-reconciliation/02-first-preview.png)

![Apply only the changes you reviewed. Actual hosted Apply and retry receipts · Fictional workbook.](https://howthtechnologyfactory.pro/assets/sheet-keyed-reconciliation/03-approved-write.png)

![Catch edits made after your preview. Actual rejected Apply message · Controlled test edit.](https://howthtechnologyfactory.pro/assets/sheet-keyed-reconciliation/04-stale-plan.png)

![Keep leading zeroes, numbers and booleans. Actual Apify HTML dataset export · Fictional workbook.](https://howthtechnologyfactory.pro/assets/sheet-keyed-reconciliation/05-typed-readback.png)

![Send sheet rows to the next Apify run. Actual hosted export receipt · Published tab.](https://howthtechnologyfactory.pro/assets/sheet-keyed-reconciliation/06-export-proof.png)

![Choose JSON, CSV or an Apify dataset. Formats verified on the hosted release build.](https://howthtechnologyfactory.pro/assets/sheet-keyed-reconciliation/07-export-options.png)

![From incoming records to verified changes. Workflow guide · Keep one writer active during Apply.](https://howthtechnologyfactory.pro/assets/sheet-keyed-reconciliation/08-workflow.png)

# Actor input Schema

## `mode` (type: `string`):

Connect Google for private workbook operations, or export an already published tab with its public CSV link.

## `publishedCsvUrl` (type: `string`):

For Export an already published tab, use a Google Sheets Publish to web CSV link. The Actor reads it without Google credentials.

## `exportDataset` (type: `boolean`):

For table exports with distinct headers. Keeps the dataset restricted, skips empty rows and escapes formula-like text.

## `spreadsheetId` (type: `string`):

The file identifier from the URL of the authorised Google workbook.

## `sheetId` (type: `integer`):

The numeric gid shown in the URL of the selected tab.

## `keyColumn` (type: `string`):

The exact header of the column with unique record keys.

## `rows` (type: `integer`):

Include the header, all current table rows and room for inserts where needed.

## `columns` (type: `integer`):

Number of table columns from column A.

## `records` (type: `array`):

Supply records inline or select a readable Apify dataset.

## `datasetId` (type: `string`):

Optional read-only input source containing up to 400 records.

## `approval` (type: `object`):

For Apply, paste the complete approval object from the preview for this exact input and table.

## `googleAccessToken` (type: `string`):

Use a short-lived token scoped to your authorised workbook, or use the service account field below.

## `googleServiceAccount` (type: `string`):

Use a dedicated Google service account shared directly on your workbook. Paste its JSON key in this encrypted field and leave the access token field blank.

## Actor input object example

```json
{
  "mode": "sample",
  "exportDataset": false,
  "rows": 100,
  "columns": 5
}
```

# Actor output Schema

## `result` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "sample"
};

// Run the Actor and wait for it to finish
const run = await client.actor("apifmcpfactory/sheet-keyed-reconciliation").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "mode": "sample" }

# Run the Actor and wait for it to finish
run = client.actor("apifmcpfactory/sheet-keyed-reconciliation").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "sample"
}' |
apify call apifmcpfactory/sheet-keyed-reconciliation --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,apifmcpfactory/sheet-keyed-reconciliation"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/wFrw1WwgGueFvauhe/builds/3HSSQQ5EIDvqg3Vix/openapi.json
