Skip to main content

Delete Rows from Excel Worksheet in n8n

Delete Rows is an n8n module by PDF4me that strips unwanted rows from an Excel worksheet in one workflow step. Send a workbook and a Row Ranges string covering single rows, ranges, or a mixed list, and PDF4me deletes them bottom-to-top and returns the cleaned file.

What this node does

PDF4me: Delete Rows removes header rows, blank lines, or outdated sections from an Excel worksheet directly in n8n. Provide the workbook as binary data, Base64, or a URL, target a specific worksheet or leave it blank for the first sheet, and supply a 1-based Row Ranges string (single rows, ranges, or a mix). Returns the cleaned workbook with the requested rows removed. Ideal for sanitizing exports before sharing, trimming templates, or dropping retention-exceeded records.

Related Blog Posts
No blog post yet for this feature — coming soon.
In the meantime, browse the PDF4me blog for tutorials and workflows across every platform.
Visit the blog

Authenticating Your API Request

Every PDF4me node in n8n requires a valid Credential to connect with. Create or select one that holds your PDF4me API key so the workflow can authenticate row-deletion requests securely.

Important Facts You Should Not Miss

Deletion runs bottom-to-top
PDF4me removes the specified rows starting from the bottom of the range upward. This avoids the row-index-shifting problem that happens with naive top-down deletion.
Row numbers are 1-based
Row 1 is the first row in the worksheet, matching what you see in Excel's row headers. There is no row 0.
Row Ranges accepts mixed lists
Combine single rows and ranges in one string, for example 1-3,10,25-30, to delete multiple non-contiguous sections in a single node execution.
PDF4me Excel Delete Rows n8n node configured with Credential PDF4me API, Operation Delete Rows, Excel File Input Method From Previous Node Binary Data, Binary Data Property Name data, Worksheet Name Sheet1 placeholder, Row Ranges 10-20, Output File Name excel_rows_deleted.xlsx, Source Document Name myExcelFile.xlsx, and Output Binary Data Name data

Full node panel: workbook via Binary Data, Row Ranges 10-20 on Sheet1

Parameters

Required in the n8n UI: Excel File Input Method, Source Document Name, and Row Ranges. Worksheet Name (defaults to the first sheet), Output File Name (default excel_rows_deleted.xlsx), and Output Binary Data Name (default data) are optional. Conditional workbook-source fields (Binary Data Property Name, Base64 Document Content, Document URL) appear only when the matching Excel File Input Method is chosen.

ParameterRequiredWhat it doesExample
Excel File Input MethodRequiredHow the workbook enters the node. From Previous Node (Binary Data) reads from a prior node (default). Base64 String accepts an encoded workbook. URL downloads it from a public link.From Previous Node (Binary Data)
Binary Data Property NameConditionalName of the binary property on the incoming n8n item that holds the workbook. Required when Excel File Input Method is Binary Data. Defaults to data.data
Base64 Document ContentConditionalBase64-encoded workbook content. Required when Excel File Input Method is Base64 String.UEsDBBQAAAA...
Document URLConditionalPublicly reachable HTTPS link to the workbook. Required when Excel File Input Method is URL.https://files.example.com/report.xlsx
Worksheet NameOptionalWorksheet to clean. Leave blank to target the first sheet in the workbook.Summary
Row RangesRequiredRow range string with 1-based row numbers. Accepts single rows, ranges, or a mixed comma-separated list. Rows are deleted bottom-to-top.1-3,10,25-30
Output File NameOptionalFilename of the cleaned workbook returned by the node. Default is excel_rows_deleted.xlsx.excel_rows_deleted.xlsx
Source Document NameRequiredLogical filename of the source workbook, used for reference and tracking in the response.myExcelFile.xlsx
Output Binary Data NameOptionalName of the binary property the output item exposes. Default is data. Use a different name when a downstream node expects it.data

What Fields Does the Output Include?

FieldTypeWhat it contains
fileNameStringName of the output workbook after row deletion, set from Output File Name (default excel_rows_deleted.xlsx).
fileSizeNumberSize of the output workbook in bytes.
successBooleanTrue when the row deletion completed successfully. Use to route error-handling branches.
originalFileNameStringThe Source Document Name that was processed, kept for audit trails.
worksheetNameStringName of the worksheet where rows were deleted.
rowRangesStringThe Row Ranges string that was used for this deletion.
messageStringDescriptive status message including the row ranges and worksheet name.
Binary (data)BinaryThe cleaned workbook under Output Binary Data Name (default data). Pass into Write Binary File, Email, or any storage upload.

How Do I Set Up Delete Rows in n8n?

  1. Add the PDF4me Excel node to your n8n workflow and set Operation to Delete Rows.
  2. In Credential to connect with, select your PDF4me credential or click Create New Credential and paste your API key.
  3. Set Excel File Input Method to From Previous Node (Binary Data) (default), Base64 String, or URL and fill the matching field.
  4. Enter Source Document Name, the logical filename of the workbook, for reference and tracking.
  5. Enter a Row Ranges string with 1-based row numbers, ranges, or a mixed list such as 1-3,10,25-30.
  6. Optionally set Worksheet Name to target a specific sheet. Leave blank to target the first sheet.
  7. Optionally change Output File Name from the default excel_rows_deleted.xlsx and Output Binary Data Name from the default data.
  8. Execute the node and route the cleaned workbook into Write Binary File, Email, or cloud storage.

Typical Setups

Workflow ExamplesCommon n8n workflow patterns using Delete Rows.
Report cleanup before client delivery
  1. A Google Drive Download node pulls the internal report workbook (Binary Data, property data).
  2. PDF4me Delete Rows runs with Row Ranges targeting the internal-notes rows and blank separator rows.
  3. A Write Binary File node saves the client-ready workbook using $json.fileName.
Template preparation for new users
  1. A Read Binary File node loads the master Excel template.
  2. PDF4me Delete Rows removes the example data rows before the template is distributed, with Worksheet Name set to the sheet holding sample rows.
  3. The cleaned template is uploaded to a shared onboarding folder.
Scheduled retention cleanup
  1. A Cron node triggers weekly on a records workbook stored at a fixed URL.
  2. An earlier step computes the Row Ranges string for retention-exceeded records and passes it into PDF4me Delete Rows with Excel File Input Method set to URL.
  3. The cleaned workbook overwrites the source file in cloud storage.

Practical Tips

Row numbers are 1-based, not 0-based
Row 1 is the first row in the worksheet, the same numbering you see in Excel itself. A common mistake is assuming index 0 is the first row.
Bottom-to-top deletion avoids shift bugs
You do not need to recalculate row numbers after each deletion. PDF4me processes the Row Ranges list from the bottom up internally.
Combine ranges in one call
Instead of running the node multiple times, pass a single mixed string like 1-3,10,25-30 to delete several sections in one execution.
Set Worksheet Name for multi-sheet workbooks
Leaving Worksheet Name blank always targets the first sheet. Set it explicitly whenever the workbook has more than one sheet.
Output File Name is separate from Source Document Name
Source Document Name tracks the input file. Output File Name controls what the cleaned workbook is called when it comes back, default excel_rows_deleted.xlsx.
Double-check the range before automating
An incorrect Row Ranges string deletes the wrong rows with no built-in undo. Test with a copy of the workbook before wiring this into a production schedule.

Cheat Sheet

FieldValue
OperationDelete Rows
Excel File Input MethodFrom Previous Node (Binary Data)
Binary Data Property Namedata
Worksheet NameSheet1
Row Ranges10-20
Output File Nameexcel_rows_deleted.xlsx
Source Document NamemyExcelFile.xlsx
Output Binary Data Namedata
CredentialsPDF4me API credential

Frequently Asked Questions

How do I delete specific rows from an Excel file in n8n?+
Add the PDF4me Excel node, set Operation to Delete Rows, provide the workbook via binary data, Base64, or URL, and enter a Row Ranges string such as 1-3,10,25-30. The node deletes those rows and returns the cleaned workbook.
Can I delete multiple non-contiguous row ranges in one action?+
Yes. Row Ranges accepts a comma-separated mix of single rows and ranges in one string. For example, 1-3,10,25-30 deletes rows 1 through 3, row 10, and rows 25 through 30 in a single execution, no looping required.
Does deleting rows shift my remaining data incorrectly?+
No. PDF4me deletes the specified rows starting from the bottom of the range and working upward, which avoids the row-index-shifting problem that occurs when rows are removed top-down and remaining indexes change mid-operation.
What happens if I leave Worksheet Name blank?+
The action targets the first worksheet in the workbook by default. Set Worksheet Name explicitly when the workbook has multiple sheets and you need to clean a sheet other than the first one.
Are row numbers 0-based or 1-based in the Row Ranges field?+
Row numbers are 1-based, matching Excel row headers directly. Row 1 is the first row in the sheet; there is no row 0.

Same Task on Other Platforms

Use Cases

  • Report cleanup: Remove internal notes, totals, or blank separators before sending to clients.
  • Template preparation: Strip example rows from Excel templates prior to onboarding new users.
  • Compliance workflows: Drop expired records or retention-exceeded rows automatically.

Get Help