Extract Rows from Excel
PDF4me Extract Rows is a REST endpoint that reads worksheet rows out of an Excel workbook and returns them as structured JSON. POST the .xlsx as Base64 to office/ApiV2Excel/ExcelExtractRows, scope the worksheet and row range in the action object, and consume the rowData array. It returns data, not a file: document comes back null.
Turns a worksheet slice into a JSON array: each row becomes one object in rowData, ready for a database insert, an API call, or a report. It is the read-only counterpart to Add Rows and Update Rows, and the API-side equivalent of exporting Excel data without opening Excel. No modified file is produced.
Authenticating Your API Request
Every PDF4me REST call must include your API key in the Authorization header as Basic auth. Get or rotate your key from the developer dashboard.
Endpoint
office/ApiV2Excel/ExcelExtractRowsImportant Facts You Should Not Miss
document and fileName come back null by design; code that expects a Base64 file there will break.HTTP setup
Method: POST
URL: https://api.pdf4me.com/office/ApiV2Excel/ExcelExtractRows
Content-Type: application/json
Authorization: Basic <your PDF4me API key>
The response is JSON: check the success flag, then iterate the rowData array. There is no file to decode.
How is Extract Rows different from the other Excel row actions?
The row family covers write, overwrite, and read. Pick by what should happen to the workbook.
| Action vs behavior | What it does to the workbook | What you get back |
|---|---|---|
| Extract Rows (this endpoint) | Nothing, read-only | A rowData JSON array, one object per row |
| Add Rows | Appends or inserts new rows | The modified workbook as Base64 |
| Update Rows | Overwrites values in existing rows | The modified workbook as Base64 |
| Delete Rows | Removes rows | The modified workbook as Base64 |
API body fields
| Parameter | Required | Type | What it does | Example |
|---|---|---|---|---|
document | Required | object | Document reference carrying Name, the Excel filename with its extension. | { "Name": "data.xlsx" } |
docContent | Required | string | Base64-encoded bytes of the workbook to read. | UEsDBBQABgAIAAAA... |
extractRowsToExcelAction | Required | object | Action configuration object. An empty object is valid and reads the default worksheet. | {} |
worksheetName | Optional | string | Inside the action object. Target worksheet by name. Names are matched exactly, so a typo silently misses the sheet. | Sheet1 |
worksheetIndex | Optional | number | Inside the action object. Target worksheet by position. The extraction engine counts 0-based, so 0 is the first sheet. | 0 |
fromRow / toRow | Optional | number | Inside the action object. Row range to extract. The engine counts rows 0-based with -1 meaning to the last data row, per the shared engine documented on the n8n Extract Rows action. | 0, -1 |
cultureName | Optional | string | Inside the action object. Culture used when serializing dates and numbers, for example en-US or de-DE. | en-US |
Sample payloads
Read the default worksheet
{
"document": { "Name": "data.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"extractRowsToExcelAction": {}
}
Read a named worksheet with culture-aware values
{
"document": { "Name": "sales.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"extractRowsToExcelAction": {
"worksheetName": "Q3",
"cultureName": "en-US"
}
}
Postman collection tips
curl example
curl -X POST https://api.pdf4me.com/office/ApiV2Excel/ExcelExtractRows \
-H "Content-Type: application/json" \
-H "Authorization: Basic YOUR_API_KEY" \
-d '{
"document": { "Name": "data.xlsx" },
"docContent": "'"$(base64 -w 0 data.xlsx)"'",
"extractRowsToExcelAction": { "worksheetName": "Sheet1" }
}' \
--output response.json
What does the API return?
A JSON result whose payload is the rowData array.
| Field | Type | What it contains |
|---|---|---|
rowData | Array of objects | The primary output. Each entry is one extracted row as a JSON object, with column names or indexes as keys. |
success | Boolean | true when extraction succeeded. Check this before iterating rowData. |
document | null | Null for this endpoint: no modified file is produced. Present only because the office family shares one response shape. |
fileName | null | Null for this endpoint, for the same reason as document. |
errorMessage | String | Populated when success is false: a missing worksheet, invalid Base64, or a corrupted workbook. |
{
"document": null,
"fileName": null,
"success": true,
"errorMessage": null,
"rowData": [
{ "ColumnA": "value1", "ColumnB": "value2" },
{ "ColumnA": "value3", "ColumnB": "value4" }
]
}
Code samples
Excel office endpoints are not yet covered by per-language sample folders; the samples repository carries the request pattern used by every PDF4me endpoint family:
FAQ
Why extract Excel data via API instead of manually?
The manual route is opening the workbook, selecting the range, copying it somewhere, and reshaping it by hand, once per file, per refresh. The API reads the same rows as one deterministic request and hands you JSON that any language parses natively, with no Excel installation on the server. Because the source stays a standard Office Open XML workbook and the operation is read-only, the same call is safe to run on a schedule against live files.