Delete Rows - Excel API
PDF4me Delete Rows enables you to remove rows from Excel documents with worksheet targeting and row range or condition support. This API service processes Excel files and deletes specified rows. The API receives Excel document content through REST API calls, utilizing Base64 encoding for secure transmission. This solution is ideal for data cleanup, template preparation, and automated Excel editing workflows.
Authenticating Your API Request
Include your API key in the request to authenticate with the PDF4me REST API.
Key Features
- Row Deletion: Remove rows by index range or condition
- Worksheet Targeting: Target specific worksheets by name or index
REST API Endpoint
- Method: POST
- Endpoint:
office/ApiV2Excel/ExcelDeleteRows
REST API Parameters
Important: Parameters marked with an asterisk (*) are required. All requests use document, docContent, and deleteRowsToExcelAction. Operation-specific parameters (worksheetName, fromRow, toRow, etc.) are properties of the action object.
Required Parameters (root level)
| Parameter | Required | What it does | Example |
|---|---|---|---|
| document | Required | Source file. `Name` must end in `.xlsx`, `.xls` or `.xlsm` (a `.csv` for `ExcelParseCsv`). | { "Name": "data.xlsx" } |
| document.Name | Required | File name including its extension. Type: string. | { "Name": "data.xlsx" } |
| docContent | Required | The source file, base64-encoded. Type: string. | UEsDBBQABgAIAAAA... |
| isAsync | Optional | Process the request in the background. The call returns `202 Accepted`; poll the `Location` URL (`GetActionStatus`) for the result. Type: boolean. | |
| deleteRowsToExcelAction | Required | Object carrying this operation's settings. Its fields are the deleteRowsToExcelAction rows below. | See Payload example below |
| deleteRowsToExcelAction.rowRanges | Required | Row numbers and ranges to delete, e.g. `"2-4,7"`. Type: string. | |
| deleteRowsToExcelAction.worksheetName | Optional | The sheet to delete rows from. Defaults to the first sheet. Type: string. | |
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...",
"deleteRowsToExcelAction": {
"fromRow": 5,
"toRow": 10
}
}