Merge Files - Excel API
PDF4me Merge Files enables you to combine multiple Excel workbooks into a single workbook with ordering control. This API service processes multiple Excel files and merges their worksheets into one output file. The API receives Excel document contents through REST API calls, utilizing Base64 encoding for secure transmission. This solution is ideal for report consolidation, workbook assembly, and automated Excel merging workflows.
Authenticating Your API Request
Include your API key in the request to authenticate with the PDF4me REST API.
Key Features
- Multiple File Support: Merge two or more Excel workbooks into one
- Ordered Merging: Control the order of worksheets in the output
REST API Endpoint
- Method: POST
- Endpoint:
office/ApiV2Excel/ExcelMergeFiles
REST API Parameters
Important: Parameters marked with an asterisk (*) are required. The API uses mergeFilesToExcelAction containing a documents (or Documents) array. Each item has Filename (or filename) and FileContent (or fileContent, Base64). Operation-specific options (outputFileName, cultureName, etc.) are inside the action object.
Required Parameters (root level)
| Parameter | Type | Description | Example |
|---|---|---|---|
| mergeFilesToExcelAction* | Object | Action configuration. Must contain documents (array); each element has filename (string) and fileContent (Base64). Documents are merged in array order | See Payload example below |
Optional Parameters (inside mergeFilesToExcelAction)
| Parameter | Type | Description | Example |
|---|---|---|---|
| outputFileName | String | Output Excel file name | merged.xlsx |
| cultureName | String | Culture code for processing | en-US |
Output
The API returns the merged Excel document as a Base64-encoded string in JSON format (document, fileName, success, errorMessage).
Request Example
Header
Content-Type: application/json
Authorization: Basic YOUR_BASE64_ENCODED_API_KEY
Payload (Basic)
{
"mergeFilesToExcelAction": {
"documents": [
{ "filename": "file1.xlsx", "fileContent": "UEsDBBQABgAIAAAA..." },
{ "filename": "file2.xlsx", "fileContent": "UEsDBBQABgAIAAAA..." }
],
"outputFileName": "merged.xlsx"
}
}