Skip to content

Instantly share code, notes, and snippets.

@sohail-aspose
Created December 23, 2020 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sohail-aspose/87c28286360b9f0b2948524ddb6d82e7 to your computer and use it in GitHub Desktop.
Save sohail-aspose/87c28286360b9f0b2948524ddb6d82e7 to your computer and use it in GitHub Desktop.
Delete Blank Rows From an Excel Document
using Aspose.Cells;
// Open an existing excel file.
Workbook wb = new Workbook("SampleInput.xlsx");
// Get the worksheets collection in the spreadsheet.
WorksheetCollection sheets = wb.Worksheets;
// Get first Worksheet from WorksheetCollection by index.
Worksheet sheet = sheets[0];
// Or by name.
// Worksheet sheet = sheets["Sheet1"];
// Delete the Blank Rows from the worksheet.
sheet.Cells.DeleteBlankRows();
// Save the excel file.
wb.Save("SampleOutput.xlsx");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment