Add Rows - Excel API
PDF4me Add Rows enables you to insert JSON data as rows into Excel documents with table-based or coordinate-based insertion modes. This API service supports automatic type conversion (strings to numbers/dates), culture-specific parsing, customizable date and numeric formatting, and null value handling. The API receives Excel document content and JSON data through REST API calls, utilizing Base64 encoding for secure transmission. This solution is ideal for automated data population, report generation, and database-to-Excel workflows.
Authenticating Your API Request
Include your API key in the request to authenticate with the PDF4me REST API.
Key Features
- Dual Insertion Modes: Table-based (header matching) or coordinate-based (exact row/column positioning)
- JSON Data Support: Insert single objects or arrays of objects as Excel rows
- Automatic Type Conversion: Convert JSON strings to Excel numbers and dates
- Format Customization: Apply custom date and numeric formatting patterns
- Culture Support: Parse dates and numbers according to specified culture codes
- Null Value Handling: Skip null values or insert as empty cells
REST API Endpoint
- Method: POST
- Endpoint:
office/ApiV2Excel/ExcelAddRows
REST API Parameters
Important: Parameters marked with an asterisk (*) are required. All requests use document, docContent, and addRowsToExcelAction. Operation-specific parameters (jsonInput, worksheetName, 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... |
| addRowsToExcelAction* | Object | Action configuration. Must contain jsonInput (string) — JSON data as array of objects or single object | See Payload example below |
Optional Parameters (inside addRowsToExcelAction)
| Parameter | Type | Description | Example |
|---|---|---|---|
| worksheetName | String | Target worksheet name. Default: "Sheet1" | Sheet1 |
| tableName | String | Excel table name for table-based mode; empty = coordinate-based mode | SalesTable |
| excelRowNumber | Number (int) | 1-based position within table (table mode only) | 5 |
| insertFromRow | Number (int) | 1-based start row (coordinate mode only) | 10 |
| insertFromColumn | Number (int) | 1-based start column (coordinate mode only) | 3 |
| convertNumericAndDate | Boolean | Automatic type conversion. Default: true | true |
| dateFormat | String | Excel date format pattern. Default: "yyyy-MM-dd" | MM/dd/yyyy |
| numericFormat | String | Excel numeric format pattern. Default: "N2" | #,##0.00 |
| ignoreNullValues | Boolean | Skip null values. Default: false | false |
| ignoreAttributeTitles | Boolean | Case-insensitive header matching. Default: false | true |
| cultureName | String | Culture for date/number parsing. Default: "en-US" | en-US |
Output
The API returns the 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)
{
"document": { "Name": "data.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"addRowsToExcelAction": {
"jsonInput": "[{\"Name\":\"John\",\"Age\":30}]"
}
}