Delete Rows from Excel in Power Automate
PDF4me Delete Rows from Excel action enables removal of specified row ranges from Excel documents in Power Automate with flexible range syntax and intelligent deletion ordering. This powerful cleanup feature supports deletion of single rows, multiple individual rows, or continuous row ranges using comma-separated range syntax, with automatic bottom-to-top deletion to prevent index shifting issues and maintain worksheet structure integrity, perfect for data cleanup, report trimming, and automated Excel file maintenance across Microsoft 365 workflows.
Authenticating Your API Request
To access the PDF4me Web API through Power Automate, every request must include proper authentication credentials. Authentication ensures secure communication and validates your identity as an authorized user, enabling seamless integration between your Power Automate flows and PDF4me's powerful Excel row deletion services.

Key Features
- Flexible Range Syntax: Delete single rows, ranges, or mixed combinations using simple comma-separated format
- Multiple Range Support: Process multiple row ranges in a single operation
- Smart Deletion Order: Automatic bottom-to-top deletion prevents index shifting issues
- Worksheet Targeting: Specify worksheet by name or use first worksheet by default
- Structure Preservation: Maintains worksheet integrity with automatic row shifting
Parameters
Complete list of parameters for the Delete Rows from Excel action. Configure these parameters to control row deletion.
Important: Parameters marked with an asterisk (***) are required and must be provided for the action to function correctly.
| Parameter | Type | Description | Example |
|---|---|---|---|
| File Content*** | Base64 | Source Excel File Content • Map Excel file from previous action output • Supports Excel files from SharePoint, OneDrive, email attachments • Can be dynamically retrieved from flow variables • Must be valid Excel document (.xlsx, .xls formats) | [File Content from Get File] |
| File Name*** | String | Excel Document Name • Specify Excel file name with extension (.xlsx, .xls) • Used for processing and output file naming • Must include proper file extension • Supports dynamic naming from flow variables | data.xlsx |
| Row Ranges*** | String | Row Ranges to Delete • Comma-separated row ranges in 1-based format (row 1 = first row) • Single row: "5" - Delete row 5 only• Range: "1-10" - Delete rows 1 through 10• Multiple rows: "5,10,15" - Delete rows 5, 10, and 15• Mixed format: "1-5,10-15,20" - Delete rows 1-5, 10-15, and row 20• Brackets optional: "[1-5]" same as "1-5"• Deletion Order: Rows deleted bottom-to-top (highest row first) to prevent index shifting | 1-5,10,15-20 |
| Worksheet Name | String | Target Worksheet Name • Name of worksheet to delete rows from • Null or empty defaults to first worksheet (index 0) • Must match worksheet name exactly • Case-sensitive worksheet name | Sheet1 |
Output
The PDF4me Delete Rows from Excel action returns comprehensive output data for seamless Power Automate flow integration:
- Table
- JSON
- Flow Integration
Table View
Response data in a structured table format:
| Parameter | Type | Description |
|---|---|---|
| document | Base64 | Excel document with specified rows deleted |
| Success | Boolean | true if operation successful, false if failed |
| Error Message | String | Error description (null if successful) |
| Errors | Array | List of detailed error information (empty array if successful) |
JSON Response Format
The raw JSON response from the action:
{
"document": "[Base64 Excel Content with Rows Deleted]",
"Success": true,
"ErrorMessage": null,
"Errors": []
}
Error Response Example:
{
"document": null,
"Success": false,
"ErrorMessage": "Invalid row ranges: Row 1000 exceeds maximum data row (50)",
"Errors": [
{
"Code": "ROW_RANGE_ERROR",
"Message": "Row 1000 exceeds maximum data row (50). Valid row range for worksheet 'Sheet1': 1 to 50"
}
]
}
Power Automate Flow Usage
Use Excel files with deleted rows in subsequent actions:
- Report Cleanup: Remove header rows, blank rows, or summary sections
- Data Trimming: Delete old records or expired entries from logs
- Template Preparation: Remove example/sample rows from Excel templates
- Quality Control: Remove invalid or flagged data rows
- Email Distribution: Send cleaned Excel files without unnecessary rows
- SharePoint Publishing: Upload trimmed Excel files to document libraries
Common Error Messages
Understanding and troubleshooting errors helps ensure smooth Excel row deletion workflows:
| Error Message | Cause | Solution |
|---|---|---|
| "Request is empty" | Request object is null | Provide valid request object |
| "Document is empty" | Document object is null | Provide valid Excel document |
| "Row ranges are required" | RowRanges is null or empty string | Provide valid row range specification |
| "Invalid worksheet selection" | WorksheetName doesn't exist in workbook | Use existing worksheet name |
| "Available worksheets in workbook (X total)" | Informational message when worksheet validation fails | Review worksheet name and use valid value from X available worksheets |
| "Invalid start row {row}. Row numbers must be positive." | Row number < 1 (e.g., "0-5", "-1") | Use row numbers ≥ 1 (1-based indexing) |
| "Row {row} exceeds maximum data row ({maxRow})" | Row number > worksheet's data row count | Use row numbers within valid range (1 to maxRow) |
| "Invalid range {start}-{end}: End row cannot be less than start row" | End row < start row (e.g., "10-5") | Ensure end row ≥ start row in ranges |
| "Invalid row range format" | Malformed range string that couldn't be parsed | Check syntax: use commas and hyphens correctly |
Workflow Examples
The PDF4me Delete Rows from Excel action in Power Automate provides comprehensive workflow templates designed for real-world business scenarios:
- Report Cleanup
- Data Archival
- Template Cleanup
- Quality Control
Automated Report Header/Footer Cleanup Workflow
Transform your report distribution with automated removal of internal headers and footers:
Complete Workflow Steps:
- Trigger: Internal report marked as "Ready for Client"
- Get Excel Report: Retrieve internal report from SharePoint
- Delete Header Rows: Remove rows 1-3 (internal headers and instructions)
- Delete Footer Rows: Remove last 5 rows (internal notes and formulas)
- Set Parameters: RowRanges = "1-3,96-100" (assuming 100 total rows)
- Add Client Headers: Insert client-appropriate headers (separate action)
- Email Client: Send cleaned report to client stakeholders
- Archive Original: Keep internal version in separate folder
Business Benefits:
- Cleans 50+ client reports monthly automatically
- Removes confidential internal notes and instructions
- Ensures professional client-ready appearance
- Saves 20 minutes per report in manual cleanup
Automated Old Data Removal Workflow
Streamline your data management with automated deletion of expired records:
Complete Workflow Steps:
- Trigger: Scheduled monthly archival process on 1st at midnight
- Get Transaction Log: Retrieve Excel transaction log from SharePoint
- Identify Old Rows: Use formula or script to identify rows older than 12 months
- Build Range String: Create RowRanges dynamically (e.g., "5-150,200,250-300")
- Delete Old Data: Remove expired transaction rows
- Verify Row Count: Confirm expected row count after deletion
- Update Archive: Save cleaned log back to SharePoint
- Send Summary: Email admin with deletion summary report
Business Benefits:
- Archives 200+ old transaction records monthly automatically
- Maintains Excel file performance with trimmed data
- Complies with data retention policies automatically
- Reduces file size by 40% average
Automated Template Sample Data Removal Workflow
Optimize your template distribution with automated removal of sample data:
Complete Workflow Steps:
- Trigger: New employee onboarding initiated in HR system
- Get Excel Template: Retrieve expense report template from templates library
- Delete Sample Rows: Remove rows 2-10 (sample expense entries)
- Set Parameters: RowRanges = "2-10", WorksheetName = "Expenses"
- Preserve Headers: Row 1 (headers) remains intact
- Personalize: Add employee name and ID to template metadata
- Email Employee: Send clean template to new hire
- Log Distribution: Record template distribution in HR system
Business Benefits:
- Prepares 30+ employee templates monthly automatically
- Removes sample data that causes confusion
- Ensures employees start with clean templates
- Reduces onboarding time by providing ready-to-use templates
Automated Invalid Data Row Removal Workflow
Enhance your data quality with automated deletion of flagged rows:
Complete Workflow Steps:
- Trigger: Data validation report completed by quality control system
- Get Data File: Retrieve Excel file with validation results
- Parse QC Results: Extract row numbers of rows marked as "Invalid"
- Build Delete Range: Create RowRanges from invalid row numbers (e.g., "15,23,47-52,88")
- Delete Invalid Rows: Remove all flagged data rows
- Recalculate Stats: Update summary statistics after deletion
- Email Data Owner: Send cleaned file to data owner for review
- Archive QC Report: Store validation report in quality folder
Business Benefits:
- Removes 50+ invalid data rows weekly automatically
- Improves data quality by eliminating bad records
- Provides clean datasets for analysis and reporting
- Reduces manual data cleanup time by 90%
Industry Use Cases & Applications
- Finance & Accounting
- Sales & Marketing
- Human Resources
- Operations & Manufacturing
- Education & Training
- Healthcare & Medical
Finance & Accounting Use Cases
- Transaction Cleanup: Delete old or void transaction rows from accounting logs
- Period Close: Remove temporary calculation rows after month-end close
- Report Distribution: Delete internal notes and review comments from client reports
- Budget Templates: Remove previous year sample data from new budget templates
Sales & Marketing Use Cases
- Lead List Cleanup: Delete unqualified or duplicate lead rows from lists
- Campaign Data: Remove test rows and invalid entries from campaign results
- Pricing Updates: Delete obsolete pricing rows from rate sheets
- Territory Management: Remove inactive territory assignments from sales data
Human Resources Use Cases
- Employee Records: Delete terminated employee rows from active rosters
- Payroll Processing: Remove sample data from payroll templates for new hires
- Benefits Enrollment: Delete expired enrollment options from benefits sheets
- Performance Reviews: Remove old review cycle data from tracking sheets
Operations & Manufacturing Use Cases
- Inventory Cleanup: Delete discontinued product rows from inventory lists
- Production Logs: Remove old production run data beyond retention period
- Quality Control: Delete invalid or rejected inspection result rows
- Maintenance Records: Remove completed maintenance task rows from active schedules
Education & Training Use Cases
- Student Rosters: Delete graduated student rows from class rosters
- Course Catalogs: Remove discontinued course rows from catalog sheets
- Grade Books: Delete sample grade entries from new semester templates
- Training Records: Remove expired certification rows from tracking sheets
Healthcare & Medical Use Cases
- Patient Lists: Delete discharged patient rows from active treatment lists
- Appointment Schedules: Remove past appointment rows from schedule templates
- Lab Results: Delete old test result rows beyond retention requirements
- Insurance Claims: Remove processed claim rows from active claims tracking