Excel

Targeting Ranges and Cells

Methods for specifying which cells, ranges, rows, or columns an Excel operation applies to.

Methods for specifying which cells, ranges, rows, or columns an Excel operation applies to.

WithRange sets an A1-notation range (e.g., 'A1:D100'). WithCell targets a single cell by address (e.g., 'C5'). WithColumn targets an entire column by letter. WithRowNumber targets an entire row by number. WriteRange writes data to a specified range directly. WithInsertPosition and WithInsertSeparator configure how InsertValue and PrependValue position and separate inserted text within a cell.

Examples

GPAL Fluent: High-level fluent C# API

//Range notation follows standard Excel A1 format. WithRange, WithCell, WithColumn, and WithRowNumber are mutually exclusive - use whichever scope matches your operation.

// Target a range for reading GPAL.Excel .WithFile("data.xlsx") .WithSheet("Summary") .WithRange("A2:E100") .SaveTo(GPAL.Grid.ToGPALObject()); // Target a single cell for writing GPAL.Excel .WithFile("report.xlsx") .WithSheet("Dashboard") .WithCell("B5") .SetValue("Q4 Total"); // Write a range with data GPAL.Excel .WithFile("output.xlsx") .WithSheet("Sheet1") .WriteRange("A1:C3");