Extract Worksheets - Excel API
PDF4me Extract Worksheets enables you to extract specific worksheets from Excel workbooks and create new workbooks containing only the selected sheets. This API service processes Excel files and outputs one or more workbooks by worksheet name or index. The API receives Excel document content through REST API calls, utilizing Base64 encoding for secure transmission. This solution is ideal for splitting workbooks, report distribution, and automated Excel extraction workflows.
Authenticating Your API Request
Include your API key in the request to authenticate with the PDF4me REST API.
Key Features
- Worksheet Extraction: Extract one or more worksheets into new workbook(s)
- Targeting by Name or Index: Select sheets by name or index
REST API Endpoint
- Method: POST
- Endpoint:
office/ApiV2Excel/ExcelExtractWorksheet
REST API Parameters
Important: Parameters marked with an asterisk (*) are required. All requests use document, docContent, and extractWorksheetToExcelAction. Operation-specific parameters (worksheetNames, worksheetIndexes, etc.) are properties of the action object.
Required Parameters (root level)
| Parameter | Type | Description | Example |
|---|---|---|---|
| document* | Object | Document reference with Name (Excel file name) | { "Name": "data.xlsx" } |
| docContent* | String (Base64) | Excel document content encoded in Base64 | UEsDBBQABgAIAAAA... |
| extractWorksheetToExcelAction* | Object | Action configuration (worksheet names or indexes to extract) | See Payload example below |
Optional Parameters (inside extractWorksheetToExcelAction)
| Parameter | Type | Description | Example |
|---|---|---|---|
| worksheetNames | Array (string[]) | Worksheet names to extract | ["Sheet1", "Summary"] |
| worksheetIndexes | Array (int[]) | Worksheet indexes to extract (0-based or 1-based per API spec) | [0, 2] |
| cultureName | String | Culture code for processing | en-US |
Output
The API returns the extracted Excel document(s) as Base64-encoded string(s) in JSON format (document or documents array, fileName, success, errorMessage). Exact response shape depends on single vs. multiple extraction.
Request Example
Header
Content-Type: application/json
Authorization: Basic YOUR_BASE64_ENCODED_API_KEY
Payload (Basic)
{
"document": { "Name": "data.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"extractWorksheetToExcelAction": {
"worksheetNames": ["Sheet1", "Summary"]
}
}