Skip to main content

Extract Rows - Excel API

PDF4me Extract Rows enables you to extract row data from Excel documents. This API service processes Excel files and returns the requested rows as structured data (e.g. array of row objects). The API receives Excel document content through REST API calls, utilizing Base64 encoding for secure transmission. This solution is ideal for data reading, reporting, and Excel-to-JSON workflows.

Authenticating Your API Request

Include your API key in the request to authenticate with the PDF4me REST API.

Key Features

  • Row Extraction: Read rows from specified worksheets and ranges
  • Structured Output: Returns row data as an array of objects (e.g. rowData)
  • Worksheet Targeting: Target specific worksheets by name or index

REST API Endpoint

  • Method: POST
  • Endpoint: office/ApiV2Excel/ExcelExtractRows

REST API Parameters

Important: Parameters marked with an asterisk (*) are required. All requests use document, docContent, and extractRowsToExcelAction. Operation-specific parameters (worksheet name, range, etc.) are properties of the action object.

Required Parameters (root level)

ParameterTypeDescriptionExample
document*ObjectDocument reference with Name (Excel file name){ "Name": "data.xlsx" }
docContent*String (Base64)Excel document content encoded in Base64UEsDBBQABgAIAAAA...
extractRowsToExcelAction*ObjectAction configuration (worksheet targeting, row range, etc.)See Payload example below

Optional Parameters (inside extractRowsToExcelAction)

ParameterTypeDescriptionExample
worksheetNameStringTarget worksheet nameSheet1
worksheetIndexNumber (int)Target worksheet index (0-based or 1-based per API spec)0
fromRow / toRowNumber (int)Row range (if applicable)1, 10
cultureNameStringCulture code for processingen-US

Output

The API returns a JSON response. For Extract Rows, the success response emphasizes rowData — an array of row objects (e.g. list of dictionaries). The document and fileName fields may be null or omitted for this endpoint because the primary output is extracted row data, not a modified file.

Status Code: 200 OK

Response Body:

{
"document": null,
"fileName": null,
"success": true,
"errorMessage": null,
"rowData": [
{ "ColumnA": "value1", "ColumnB": "value2" },
{ "ColumnA": "value3", "ColumnB": "value4" }
]
}

Response Fields (Extract Rows):

  • rowData (array): Primary output. Array of row objects; each object represents one row (column names or indexes as keys).
  • success (boolean): Indicates whether the request succeeded.
  • document (string or null): May be null for Extract Rows — this endpoint returns row data, not a file.
  • fileName (string or null): May be null for Extract Rows.
  • errorMessage (string or null): Error details when success is false.

Request Example

Content-Type: application/json
Authorization: Basic YOUR_BASE64_ENCODED_API_KEY

Payload (Basic)

{
"document": { "Name": "data.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"extractRowsToExcelAction": {}
}

Payload (With worksheet)

{
"document": { "Name": "data.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"extractRowsToExcelAction": {
"worksheetName": "Sheet1",
"cultureName": "en-US"
}
}

Code Samples

Get Help