Skip to main content

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)

ParameterTypeDescriptionExample
document*ObjectDocument reference with Name (Excel file name){ "Name": "data.xlsx" }
docContent*String (Base64)Excel document content encoded in Base64UEsDBBQABgAIAAAA...
addRowsToExcelAction*ObjectAction configuration. Must contain jsonInput (string) — JSON data as array of objects or single objectSee Payload example below

Optional Parameters (inside addRowsToExcelAction)

ParameterTypeDescriptionExample
worksheetNameStringTarget worksheet name. Default: "Sheet1"Sheet1
tableNameStringExcel table name for table-based mode; empty = coordinate-based modeSalesTable
excelRowNumberNumber (int)1-based position within table (table mode only)5
insertFromRowNumber (int)1-based start row (coordinate mode only)10
insertFromColumnNumber (int)1-based start column (coordinate mode only)3
convertNumericAndDateBooleanAutomatic type conversion. Default: truetrue
dateFormatStringExcel date format pattern. Default: "yyyy-MM-dd"MM/dd/yyyy
numericFormatStringExcel numeric format pattern. Default: "N2"#,##0.00
ignoreNullValuesBooleanSkip null values. Default: falsefalse
ignoreAttributeTitlesBooleanCase-insensitive header matching. Default: falsetrue
cultureNameStringCulture 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

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}]"
}
}

Code Samples

Get Help