# Spreadsheet to JSON: Excel (XLSX, XLS) and CSV rows (`examsens.ai/spreadsheet-to-json`) Actor

Turns Excel and CSV files, by URL or upload, into JSON rows: every sheet or the sheets you name, header row found automatically, numbers, booleans and dates kept as types.

- **URL**: https://apify.com/examsens.ai/spreadsheet-to-json.md
- **Developed by:** [Ed Rayyis](https://apify.com/examsens.ai) (community)
- **Categories:** Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.09 / 1,000 row outputs

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

## Spreadsheet to JSON: Excel (XLSX, XLS) and CSV rows

Give it Excel or CSV files, by link or from an Apify key-value store you upload them to, and it returns every row as a JSON object keyed by the column headers. One run can take many files.

- Reads XLSX, legacy XLS, CSV and TSV. The format comes from the file's content, so a file with the wrong extension still reads.
- Reads every sheet, or only the sheets you name. Name a sheet by its name (any letter case) or its number, where 1 is the first sheet.
- Finds the header row for you. A title line or blank rows above the table are skipped: in a sheet with a report title in row 1 and the headers in row 3, the rows start under row 3. You can also set the header row number, or turn headers off and get columns named A, B, C.
- Keeps value types. Numbers stay numbers, TRUE and FALSE become true and false, and Excel dates and times become ISO 8601 text such as `2026-01-05` or `2026-02-07T13:30:00`. In CSV files, a value with a leading zero such as the ZIP code `02134` stays text. Turn type inference off to get every value as text.
- Detects the CSV delimiter (comma, semicolon, tab or pipe) and handles UTF-8 files with or without a byte order mark.
- Accepts a Google Sheets link when the sheet is shared with anyone who has the link.
- Blank header cells get a name such as `column_F`, and a repeated header gets a suffix: the second `Amount` column becomes `Amount_2`.
- Trims text values and skips empty rows.

### Input

- File URLs: direct links to the files, or Google Sheets links
- Files in a key-value store: to use files from your computer, upload them to a key-value store under Storage in Apify Console and pick the store here. Every record whose name ends in `.xlsx`, `.xlsm`, `.xls`, `.csv`, `.tsv` or `.txt` is read
- Record keys (optional): read only these records from the picked store
- Sheets (optional): names or numbers. Leave empty for every sheet
- Header row: Detect (default), Row number, or No header
- Header row number (default 1), used with Row number
- Keep value types (default on)
- Skip empty rows (default on)
- Add file, sheet and row number (default on): adds `_file`, `_sheet` and `_row` to each row
- Maximum rows per sheet (default 100,000)
- CSV delimiter (optional, detected when empty)
- Maximum file size in MB (default 50)

### Output

Dataset: one item per data row. With the default settings each row also carries `_file`, `_sheet` (the sheet name, or `CSV`) and `_row` (the row number in the sheet). Export as JSON, CSV or Excel, or read it over the API.

A file that cannot be read gets one item with `_file` and an `error` field, and the run moves on to the next file. Errors include a link that answers HTTP 404, a link that returns a web page in place of a file, a Google Sheets link that cannot be downloaded, a PDF or other file that is not a spreadsheet, a damaged workbook, a sheet name that is not in the file, and a header row number past the end of the sheet.

The key-value store holds a `SUMMARY` record: for each file, its format, the sheets it contains, and for each sheet read, the header row used, the column names and the number of rows output.

### Pricing

Pay per event: one event per row output. Error items are not charged. Set the maximum rows per sheet to control cost. The run stops when it reaches the maximum charge you set.

### Scope and conduct

The actor downloads only the files you list. It doesn't recalculate formulas: a formula cell gives the value stored in the file when it was last saved, or null when the file stores none. It doesn't change your files or keep them after the run.

### Support

Questions and problems: the Issues tab on this page.

# Actor input Schema

## `fileUrls` (type: `array`):

Direct links to XLSX, XLS, CSV or TSV files. A Google Sheets link works when the sheet is shared with anyone who has the link.

## `fileStore` (type: `string`):

To use files from your computer, upload them to a key-value store under Storage in Apify Console, then pick that store here. Every record whose name ends in .xlsx, .xlsm, .xls, .csv, .tsv or .txt is read, unless you list record keys below.

## `fileStoreKeys` (type: `array`):

Read only these records from the picked key-value store. Leave empty to read every spreadsheet record.

## `sheets` (type: `array`):

Sheet names or sheet numbers (1 is the first sheet) to read. Leave empty to read every sheet. Ignored for CSV files.

## `headerMode` (type: `string`):

Detect: use the first row near the top that is filled with text labels, skipping title rows above it. Row number: use the row you give below. No header: name the columns A, B, C.

## `headerRowNumber` (type: `integer`):

Used when Header row is set to Row number. Rows above it are skipped.

## `inferTypes` (type: `boolean`):

Output numbers, true and false as JSON numbers and booleans, and dates as ISO 8601 text. CSV text that looks like a number becomes a number, except values with a leading zero such as ZIP codes. Off: every value is text.

## `skipEmptyRows` (type: `boolean`):

Leave out rows with no value in any column.

## `includeMetadata` (type: `boolean`):

Add \_file, \_sheet and \_row fields to each row so you can trace it back to its source.

## `maxRowsPerSheet` (type: `integer`):

Stop reading a sheet after this many data rows. Each row output is one billable event.

## `csvDelimiter` (type: `string`):

Leave empty to detect comma, semicolon, tab or pipe. Type tab for tab separated files.

## `maxFileSizeMb` (type: `integer`):

Larger files are reported as an error and not read.

## Actor input object example

```json
{
  "fileUrls": [
    "https://raw.githubusercontent.com/plotly/datasets/master/2014_usa_states.csv"
  ],
  "headerMode": "auto",
  "headerRowNumber": 1,
  "inferTypes": true,
  "skipEmptyRows": true,
  "includeMetadata": true,
  "maxRowsPerSheet": 100000,
  "maxFileSizeMb": 50
}
```

# Actor output Schema

## `results` (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 = {
    "fileUrls": [
        "https://raw.githubusercontent.com/plotly/datasets/master/2014_usa_states.csv"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("examsens.ai/spreadsheet-to-json").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 = { "fileUrls": ["https://raw.githubusercontent.com/plotly/datasets/master/2014_usa_states.csv"] }

# Run the Actor and wait for it to finish
run = client.actor("examsens.ai/spreadsheet-to-json").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 '{
  "fileUrls": [
    "https://raw.githubusercontent.com/plotly/datasets/master/2014_usa_states.csv"
  ]
}' |
apify call examsens.ai/spreadsheet-to-json --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,examsens.ai/spreadsheet-to-json"
        }
    }
}
```

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/z6LGSjmGOb6SLq0af/builds/utZN8g4y1f4XH5Op1/openapi.json
