# Inventory CSV Preflight (`everyday_shortcuts_lab/inventory-csv-preflight`) Actor

Check inventory CSVs for duplicate or conflicting SKU/location keys, blank fields, quantity and price policy violations, whitespace and formula-like text. Read-only JSON and HTML reports preserve leading zeros. Findings apply only to selected rules.

- **URL**: https://apify.com/everyday_shortcuts_lab/inventory-csv-preflight.md
- **Developed by:** [Everyday Shortcuts Lab](https://apify.com/everyday_shortcuts_lab) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1,000.00 / 1,000 completed reports

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/running/actors-in-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

## Inventory CSV Preflight

Check inventory CSVs without changing the source. Get a readable HTML report and JSON findings for your next automation step. Leading zeros in product identifiers are preserved.

### How to use it

1. Paste CSV text with its header row.
2. Select the exact SKU column and, optionally, a location column.
3. Choose required fields, quantity columns, price columns, and whether negative quantities are allowed.
4. Run the check and open **HTML report** in Output. Use **JSON report** or Storage to retrieve structured findings.

Example input:

```json
{
  "csvText": "SKU,Location,Quantity,Price\n000123,North,4,9.99\n",
  "skuColumn": "SKU",
  "locationColumn": "Location",
  "quantityColumns": ["Quantity"],
  "priceColumns": ["Price"],
  "requiredColumns": [],
  "allowNegativeQuantities": false
}
```

### What it checks

- Blank or whitespace-only keys and required fields.
- Duplicate or conflicting rows with the same SKU/location key.
- Leading or trailing whitespace.
- Whole-number quantities under your chosen negative-quantity policy.
- Finite, nonnegative prices.
- Formula-like text for review. A warning does not prove that a spreadsheet will execute it.

Column names and keys are case-sensitive. Findings apply only to the selected rules. This tool does not repair files, validate a specific importer, or guarantee that an import will succeed.

### Limits and reports

Up to 5 MiB of UTF-8 CSV, 50,000 data rows, and 50 columns. Reports include the input hash, row numbers, selected rules, and complete finding counts. At most 10,000 individual finding details are returned, with omitted details clearly counted. Duplicate groups retain their full row-number lists.

Each completed run also writes one compact default-dataset summary with status, aggregate record and finding counts, the input hash, and the `REPORT` and `REPORT.html` storage keys. It contains no CSV values or finding previews.

HTML is intended for the Output preview. If Chrome cannot preview JSON there, open or download the JSON record from Storage instead.

### Data handling

Submit inventory data only, without personal data, customer or employee records, credentials, or other sensitive values. Inputs and reports stay in the Apify run's storage under its configured retention rules. Reports can contain short previews of flagged values. The checker does not send your CSV to outside APIs or access a store account.

### Price and support

The price is **$1 per completed report**, including platform usage. Both report formats are saved before a report charge is requested. Rejected input or a failure to generate or save the reports does not request a report charge. The live pricing shown by Apify governs each run.

For a reproducible problem, open an Actor issue with the selected rules and a small synthetic example. Do not post private input data in public issues.

# Actor input Schema

## `csvText` (type: `string`):

Paste the complete CSV, including its header row.

## `skuColumn` (type: `string`):

Exact, case-sensitive column used as the primary inventory key. Leading zeros are preserved.

## `locationColumn` (type: `string`):

Optional exact location column. When selected, each SKU and location pair is checked as a key.

## `quantityColumns` (type: `array`):

Columns checked as strict integers.

## `priceColumns` (type: `array`):

Columns checked as finite nonnegative decimals.

## `requiredColumns` (type: `array`):

Exact column names whose cells must not be blank or whitespace-only.

## `allowNegativeQuantities` (type: `boolean`):

Select the quantity policy appropriate for the destination workflow.

## Actor input object example

```json
{
  "csvText": "SKU,Location,Quantity,Price\nDEMO-001,Warehouse-A,4,9.99\n",
  "skuColumn": "SKU",
  "locationColumn": "Location",
  "quantityColumns": [
    "Quantity"
  ],
  "priceColumns": [
    "Price"
  ],
  "requiredColumns": [],
  "allowNegativeQuantities": false
}
```

# Actor output Schema

## `htmlReport` (type: `string`):

Standalone human-readable report with escaped issue details.

## `jsonReport` (type: `string`):

Machine-readable findings, counts, selected rules, and input hash.

# 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 = {
    "csvText": `SKU,Location,Quantity,Price
DEMO-001,Warehouse-A,4,9.99`,
    "skuColumn": "SKU",
    "locationColumn": "Location",
    "quantityColumns": [
        "Quantity"
    ],
    "priceColumns": [
        "Price"
    ],
    "requiredColumns": [],
    "allowNegativeQuantities": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("everyday_shortcuts_lab/inventory-csv-preflight").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 = {
    "csvText": """SKU,Location,Quantity,Price
DEMO-001,Warehouse-A,4,9.99
""",
    "skuColumn": "SKU",
    "locationColumn": "Location",
    "quantityColumns": ["Quantity"],
    "priceColumns": ["Price"],
    "requiredColumns": [],
    "allowNegativeQuantities": False,
}

# Run the Actor and wait for it to finish
run = client.actor("everyday_shortcuts_lab/inventory-csv-preflight").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 '{
  "csvText": "SKU,Location,Quantity,Price\\nDEMO-001,Warehouse-A,4,9.99\\n",
  "skuColumn": "SKU",
  "locationColumn": "Location",
  "quantityColumns": [
    "Quantity"
  ],
  "priceColumns": [
    "Price"
  ],
  "requiredColumns": [],
  "allowNegativeQuantities": false
}' |
apify call everyday_shortcuts_lab/inventory-csv-preflight --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,everyday_shortcuts_lab/inventory-csv-preflight"
        }
    }
}
```

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/19lns6bTohVwhfvEY/builds/zNqfsHBJ2xGTXVyln/openapi.json
