GPAL - Generally Positive Automation Library v1.0
GPAL The Fluent Automation LIbrary
Loading...
Searching...
No Matches
GenerallyPositive.GPALExcel Class Reference

Provides fluent, file-based automation of Excel workbooks: opening one or more workbooks (including wildcard-matched sets of files), selecting a sheet, reading/writing ranges, columns, rows and individual cells, performing simple aggregate calculations (sum/count), comparing ranges against a grid, another file, or another range, and saving results back to a file, grid, or sheet. All operations apply to every workbook currently loaded via WithFile(GPALFile), so a single chain can drive many files at once. Errors are reported via GPAL.PublishSimpleEvent rather than thrown. More...

Inheritance diagram for GenerallyPositive.GPALExcel:
GenerallyPositive.IGPALExcel GenerallyPositive.IAllowExcelFileSelection GenerallyPositive.IAllowExcelSheetSelection GenerallyPositive.IAllowExcelOperations GenerallyPositive.IAllowExcelCellSettings GenerallyPositive.IAllowExcelSearchAndReplaceSettings GenerallyPositive.IAllowExcelCompareSettings GenerallyPositive.IAllowToGPALObject< TResult > GenerallyPositive.IAllowExcelCore GenerallyPositive.IAllowExcelCore GenerallyPositive.IAllowToGPALObject< TResult > GenerallyPositive.IAllowExcelSheetSelection GenerallyPositive.IAllowExcelCompareSettings GenerallyPositive.IAllowExcelCore GenerallyPositive.IAllowExcelCore GenerallyPositive.IAllowToGPALObject< TResult >

Public Member Functions

IGPALExcel ToGPALObject ()
 Returns this instance as an IGPALExcel, completing the fluent configuration chain.
IAllowExcelSheetSelection WithFile (GPALFile gpalFile)
 Resets this instance and loads the workbook(s) matching gpalFile 's filenames (which may include wildcard patterns), opening each matched file with ClosedXML. Replaces any previously loaded workbooks, range data, and comparison results.
IAllowExcelSheetSelection WithNewFile (GPALFile gpalFile)
 Starts a workbook of the workflow's own at gpalFile , holding one sheet and nothing else. Nothing reaches the disk until SaveTo(GPALFile) or Close(bool) with true, the same as a workbook that was loaded.
IAllowExcelOperations WithNewSheet (string sheetName)
 Adds a sheet named sheetName to every loaded workbook and works on it from here. A workbook already holding a sheet of that name keeps the one it has.
IAllowExcelOperations InputFrom (IGPALGrid< string > grid)
 Writes grid into the current sheet, starting at the cell WithCell(string) named or A1. This is how a workflow's own data gets into a workbook: everything else here moves data that the workbook already held.
IAllowExcelOperations WithSheet (int sheetIndex)
 Selects the sheet at the given 1-based index for subsequent Excel operations on every loaded workbook.
IAllowExcelOperations WithSheet (string sheetName)
 Selects the sheet with the given name (case-insensitive) for subsequent Excel operations on every loaded workbook.
IAllowExcelOperations WithRange (string range)
 Reads the given cell range from the currently selected sheet of every loaded workbook and stores the data for use by subsequent operations (e.g. SaveTo(IGPALGrid<string>), WriteRange(string), comparisons). If a previous read/write operation has already been performed on this instance, prior range data and comparison differences are cleared first.
IAllowExcelOperations WriteRange (string range)
 Writes the range data previously read via WithRange(string) (or another data-producing operation) to range on the currently selected sheet of every loaded workbook.
IAllowExcelOperations ClearRanges ()
 Clears any range data read via WithRange(string), WithColumn(string), or WithRowNumber(int), along with any comparison differences accumulated by the CompareTo* methods.
IAllowExcelCellSettings WithCell (string cell)
 Selects a single cell address (e.g. "B3") on the currently selected sheet as the target for subsequent cell operations such as SetValue(string), InsertValue(string), AppendValue(string), and PrependValue(string).
IAllowExcelSearchAndReplaceSettings WithSearchValue (string value)
 Sets the value to search for in subsequent ReplaceWith(string) operations.
IAllowExcelOperations WithColumn (string column)
 Reads every value in the given column from the currently selected sheet of the first loaded workbook that has the selected sheet, storing the result (one value per row) for use by subsequent operations. If a previous read/write operation has already been performed on this instance, prior range data and comparison differences are cleared first.
IAllowExcelOperations WithRowNumber (int rowNumber)
 Reads every value in the given row from the currently selected sheet of the first loaded workbook that has the selected sheet, storing the result (a single row of values) for use by subsequent operations. If a previous read/write operation has already been performed on this instance, prior range data and comparison differences are cleared first.
IAllowExcelOperations CalculateSum (out string result)
 Sums every numeric value across all previously read range data (non-numeric values are ignored).
IAllowExcelOperations CalculateCount (out string result)
 Counts every non-empty value across all previously read range data.
IAllowExcelOperations CompareToGrid (IGPALGrid< string > grid)
 Compares each previously read range against grid , recording any cell-level differences for retrieval via GetCompareResults(out IGPALGrid<string>).
IAllowExcelOperations CompareToFile (GPALFile gpalFile)
 Compares each previously read range against the same range/sheet in the workbook(s) matching gpalFile 's filenames (which may include wildcard patterns), recording any cell-level differences for retrieval via GetCompareResults(out IGPALGrid<string>).
IAllowExcelOperations CompareToRange (string range)
 Compares each previously read range against range on the currently selected sheet of every loaded workbook, recording any cell-level differences for retrieval via GetCompareResults(out IGPALGrid<string>).
IAllowExcelOperations GetCompareResults (out IGPALGrid< string > results)
 Returns the cell-level differences accumulated by the CompareTo* methods (CompareToGrid(IGPALGrid<string>), CompareToFile(GPALFile), CompareToRange(string)) as a grid with columns: File, Sheet, Cell, SourceRange, TargetRange, OldValue, NewValue.
IAllowExcelCellSettings WithInsertPosition (int position)
 Sets where InsertValue(string) places its value relative to the current cell content: 0 inserts before the existing content, any other value inserts after.
IAllowExcelCellSettings WithInsertSeparator (string separator)
 Sets the separator that InsertValue(string) places between the inserted value and the cell's existing content. Defaults to a single space.
IAllowExcelOperations InsertValue (string value)
 Inserts value into the cell selected via WithCell(string) on every loaded workbook, combined with the cell's existing content using the separator from WithInsertSeparator(string) and positioned according to WithInsertPosition(int). Requires WithCell(string), WithInsertPosition(int), and WithInsertSeparator(string) to have been called first.
IAllowExcelOperations SetValue (string value)
 Sets the value of the cell selected via WithCell(string) on every loaded workbook, replacing any existing content.
IAllowExcelOperations AppendValue (string value)
 Appends value to the end of the existing content of the cell selected via WithCell(string) on every loaded workbook.
IAllowExcelOperations PrependValue (string value)
 Prepends value to the beginning of the existing content of the cell selected via WithCell(string) on every loaded workbook.
IAllowExcelOperations ReplaceWith (string value)
 Replaces every occurrence of the value set via WithSearchValue(string) with value , within each previously read range, on the currently selected sheet of every loaded workbook.
IAllowExcelOperations GetSearchResults (out IGPALGrid< string > results)
 Every cell in the range holding the search value, as a grid shaped the way GetCompareResults shapes its answer: a header row, then one row per hit.
The find half of search and replace, on the same .WithRange and .WithSearchValue that ReplaceWith acts on. Every match rather than the first, because a range holding exactly one is the exception, and the file and sheet ride on each row because the search walks every workbook that is loaded.
IAllowExcelOperations SaveTo (GPALFile gpalFile)
 Saves the loaded workbook(s) to the file(s) matching gpalFile 's filenames (which may include wildcard patterns), or to _gpalFile if gpalFile is null. A workbook whose source path is among the resolved targets is saved in place; otherwise its sheets are copied into a new workbook saved at each resolved target path.
IAllowExcelOperations SaveTo (ref IGPALGrid< string > grid)
 Appends every row from the previously read range data into grid .
The grid is taken by reference because it is what the read lands in: the workflow reads it back afterwards, and anything already in it, including a IGPALGrid<T>.WithDedupeData setting, is kept. Pass null and GPAL makes one, the same as GetGrid does.
IAllowExcelOperations SaveTo (string sheetName)
 Writes the previously read range data into the sheet named sheetName of every loaded workbook, creating the sheet if it does not exist. If a cell was selected via WithCell(string), only the first value of the last read range is written to that cell; otherwise the full data is written starting at the last read range's address.
IAllowExcelOperations SaveTo (int sheetIndex)
 Writes the previously read range data into the sheet at the given 1-based index of every loaded workbook, creating the sheet (named "Sheet{sheetIndex}") if it does not exist. If a cell was selected via WithCell(string), only the first value of the last read range is written to that cell; otherwise the full data is written starting at the last read range's address.
void Close (bool saveOnClose)
 Closes every loaded workbook, optionally saving each back to its source path first, and clears all cached state. A subsequent operation on this instance will reload the workbooks via ReopenIfClosed. If this instance is already closed, this is a no-op.

Detailed Description

Provides fluent, file-based automation of Excel workbooks: opening one or more workbooks (including wildcard-matched sets of files), selecting a sheet, reading/writing ranges, columns, rows and individual cells, performing simple aggregate calculations (sum/count), comparing ranges against a grid, another file, or another range, and saving results back to a file, grid, or sheet. All operations apply to every workbook currently loaded via WithFile(GPALFile), so a single chain can drive many files at once. Errors are reported via GPAL.PublishSimpleEvent rather than thrown.

GPAL.Excel
.WithFile("data.xlsx")
.WithSheet("Sheet1")
.WithRange("A1:B10")
.SaveTo(myGrid);

Definition at line 45 of file GPALExcel.cs.

Member Function Documentation

◆ AppendValue()

IAllowExcelOperations GenerallyPositive.GPALExcel.AppendValue ( string value)

Appends value to the end of the existing content of the cell selected via WithCell(string) on every loaded workbook.

Parameters
valueThe value to append.
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelCellSettings.

Definition at line 1375 of file GPALExcel.cs.

◆ CalculateCount()

IAllowExcelOperations GenerallyPositive.GPALExcel.CalculateCount ( out string result)

Counts every non-empty value across all previously read range data.

Parameters
resultThe count as a string, or "0" if no range data is available or the count fails.
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelOperations.

Definition at line 819 of file GPALExcel.cs.

◆ CalculateSum()

IAllowExcelOperations GenerallyPositive.GPALExcel.CalculateSum ( out string result)

Sums every numeric value across all previously read range data (non-numeric values are ignored).

Parameters
resultThe sum as a string, or "0" if no range data is available or the sum fails.
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelOperations.

Definition at line 777 of file GPALExcel.cs.

◆ ClearRanges()

IAllowExcelOperations GenerallyPositive.GPALExcel.ClearRanges ( )

Clears any range data read via WithRange(string), WithColumn(string), or WithRowNumber(int), along with any comparison differences accumulated by the CompareTo* methods.

Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelOperations.

Definition at line 582 of file GPALExcel.cs.

◆ Close()

void GenerallyPositive.GPALExcel.Close ( bool saveOnClose)

Closes every loaded workbook, optionally saving each back to its source path first, and clears all cached state. A subsequent operation on this instance will reload the workbooks via ReopenIfClosed. If this instance is already closed, this is a no-op.

Parameters
saveOnClosetrue to save each workbook to its original path before closing; otherwise false.

Implements GenerallyPositive.IAllowExcelCore.

Definition at line 1937 of file GPALExcel.cs.

◆ CompareToFile()

IAllowExcelOperations GenerallyPositive.GPALExcel.CompareToFile ( GPALFile gpalFile)

Compares each previously read range against the same range/sheet in the workbook(s) matching gpalFile 's filenames (which may include wildcard patterns), recording any cell-level differences for retrieval via GetCompareResults(out IGPALGrid<string>).

Parameters
gpalFileThe file (or wildcard pattern) identifying the workbook(s) to compare against.
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelCompareSettings.

Definition at line 939 of file GPALExcel.cs.

◆ CompareToGrid()

IAllowExcelOperations GenerallyPositive.GPALExcel.CompareToGrid ( IGPALGrid< string > grid)

Compares each previously read range against grid , recording any cell-level differences for retrieval via GetCompareResults(out IGPALGrid<string>).

Parameters
gridThe grid to compare each read range against.
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelCompareSettings.

Definition at line 861 of file GPALExcel.cs.

◆ CompareToRange()

IAllowExcelOperations GenerallyPositive.GPALExcel.CompareToRange ( string range)

Compares each previously read range against range on the currently selected sheet of every loaded workbook, recording any cell-level differences for retrieval via GetCompareResults(out IGPALGrid<string>).

Parameters
rangeThe cell range to compare each previously read range against (e.g. "A1:B10").
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelCompareSettings.

Definition at line 1073 of file GPALExcel.cs.

◆ GetCompareResults()

IAllowExcelOperations GenerallyPositive.GPALExcel.GetCompareResults ( out IGPALGrid< string > results)

Returns the cell-level differences accumulated by the CompareTo* methods (CompareToGrid(IGPALGrid<string>), CompareToFile(GPALFile), CompareToRange(string)) as a grid with columns: File, Sheet, Cell, SourceRange, TargetRange, OldValue, NewValue.

Parameters
resultsThe comparison results, with a header row even if no differences were found.
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelOperations.

Definition at line 1169 of file GPALExcel.cs.

◆ GetSearchResults()

IAllowExcelOperations GenerallyPositive.GPALExcel.GetSearchResults ( out IGPALGrid< string > results)

Every cell in the range holding the search value, as a grid shaped the way GetCompareResults shapes its answer: a header row, then one row per hit.
The find half of search and replace, on the same .WithRange and .WithSearchValue that ReplaceWith acts on. Every match rather than the first, because a range holding exactly one is the exception, and the file and sheet ride on each row because the search walks every workbook that is loaded.

GPAL.ExcelFor(book)
.WithRange("A1:Z1")
.WithSearchValue("Amount")
.GetSearchResults(out IGPALGrid<string> hits);
// header row, then File | Sheet | Cell | Row | Column
string amountColumn = 1 < hits.Rows ? hits[1][4] : null;
Everything starts here, all the GPAL controls and global settings using fluent syntax are here....
Definition GPAL.cs:49
Parameters
resultsReceives the hits, holding only the header row when nothing matched
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelSearchAndReplaceSettings.

Definition at line 1563 of file GPALExcel.cs.

◆ InputFrom()

IAllowExcelOperations GenerallyPositive.GPALExcel.InputFrom ( IGPALGrid< string > grid)

Writes grid into the current sheet, starting at the cell WithCell(string) named or A1. This is how a workflow's own data gets into a workbook: everything else here moves data that the workbook already held.

Parameters
gridThe rows to write.
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelOperations.

Definition at line 303 of file GPALExcel.cs.

◆ InsertValue()

IAllowExcelOperations GenerallyPositive.GPALExcel.InsertValue ( string value)

Inserts value into the cell selected via WithCell(string) on every loaded workbook, combined with the cell's existing content using the separator from WithInsertSeparator(string) and positioned according to WithInsertPosition(int). Requires WithCell(string), WithInsertPosition(int), and WithInsertSeparator(string) to have been called first.

Parameters
valueThe value to insert.
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelCellSettings.

Definition at line 1263 of file GPALExcel.cs.

◆ PrependValue()

IAllowExcelOperations GenerallyPositive.GPALExcel.PrependValue ( string value)

Prepends value to the beginning of the existing content of the cell selected via WithCell(string) on every loaded workbook.

Parameters
valueThe value to prepend.
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelCellSettings.

Definition at line 1431 of file GPALExcel.cs.

◆ ReplaceWith()

IAllowExcelOperations GenerallyPositive.GPALExcel.ReplaceWith ( string value)

Replaces every occurrence of the value set via WithSearchValue(string) with value , within each previously read range, on the currently selected sheet of every loaded workbook.

Parameters
valueThe replacement value.
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelSearchAndReplaceSettings.

Definition at line 1487 of file GPALExcel.cs.

◆ SaveTo() [1/4]

IAllowExcelOperations GenerallyPositive.GPALExcel.SaveTo ( GPALFile gpalFile)

Saves the loaded workbook(s) to the file(s) matching gpalFile 's filenames (which may include wildcard patterns), or to _gpalFile if gpalFile is null. A workbook whose source path is among the resolved targets is saved in place; otherwise its sheets are copied into a new workbook saved at each resolved target path.

Parameters
gpalFileThe file (or wildcard pattern) identifying where to save, or null to save back to the originally loaded file(s).
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelCore.

Definition at line 1622 of file GPALExcel.cs.

◆ SaveTo() [2/4]

IAllowExcelOperations GenerallyPositive.GPALExcel.SaveTo ( int sheetIndex)

Writes the previously read range data into the sheet at the given 1-based index of every loaded workbook, creating the sheet (named "Sheet{sheetIndex}") if it does not exist. If a cell was selected via WithCell(string), only the first value of the last read range is written to that cell; otherwise the full data is written starting at the last read range's address.

Parameters
sheetIndexThe 1-based index of the destination sheet.
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelCore.

Definition at line 1865 of file GPALExcel.cs.

◆ SaveTo() [3/4]

IAllowExcelOperations GenerallyPositive.GPALExcel.SaveTo ( ref IGPALGrid< string > grid)

Appends every row from the previously read range data into grid .
The grid is taken by reference because it is what the read lands in: the workflow reads it back afterwards, and anything already in it, including a IGPALGrid<T>.WithDedupeData setting, is kept. Pass null and GPAL makes one, the same as GetGrid does.

Parameters
gridThe grid to append the read range data to, or null for GPAL to make one.
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelCore.

Definition at line 1731 of file GPALExcel.cs.

◆ SaveTo() [4/4]

IAllowExcelOperations GenerallyPositive.GPALExcel.SaveTo ( string sheetName)

Writes the previously read range data into the sheet named sheetName of every loaded workbook, creating the sheet if it does not exist. If a cell was selected via WithCell(string), only the first value of the last read range is written to that cell; otherwise the full data is written starting at the last read range's address.

Parameters
sheetNameThe name of the destination sheet.
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelCore.

Definition at line 1789 of file GPALExcel.cs.

◆ SetValue()

IAllowExcelOperations GenerallyPositive.GPALExcel.SetValue ( string value)

Sets the value of the cell selected via WithCell(string) on every loaded workbook, replacing any existing content.

Parameters
valueThe value to set.
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelCellSettings.

Definition at line 1321 of file GPALExcel.cs.

◆ ToGPALObject()

IGPALExcel GenerallyPositive.GPALExcel.ToGPALObject ( )

Returns this instance as an IGPALExcel, completing the fluent configuration chain.

Implements GenerallyPositive.IAllowToGPALObject< TResult >.

Definition at line 141 of file GPALExcel.cs.

◆ WithCell()

IAllowExcelCellSettings GenerallyPositive.GPALExcel.WithCell ( string cell)

Selects a single cell address (e.g. "B3") on the currently selected sheet as the target for subsequent cell operations such as SetValue(string), InsertValue(string), AppendValue(string), and PrependValue(string).

Parameters
cellThe cell address to target.
Returns
Fluent interface to define cell-related settings or perform Excel operations.

Implements GenerallyPositive.IAllowExcelOperations.

Definition at line 602 of file GPALExcel.cs.

◆ WithColumn()

IAllowExcelOperations GenerallyPositive.GPALExcel.WithColumn ( string column)

Reads every value in the given column from the currently selected sheet of the first loaded workbook that has the selected sheet, storing the result (one value per row) for use by subsequent operations. If a previous read/write operation has already been performed on this instance, prior range data and comparison differences are cleared first.

Parameters
columnThe column letter(s) to read (e.g. "A").
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelOperations.

Definition at line 654 of file GPALExcel.cs.

◆ WithFile()

IAllowExcelSheetSelection GenerallyPositive.GPALExcel.WithFile ( GPALFile gpalFile)

Resets this instance and loads the workbook(s) matching gpalFile 's filenames (which may include wildcard patterns), opening each matched file with ClosedXML. Replaces any previously loaded workbooks, range data, and comparison results.

Parameters
gpalFileThe file (or wildcard pattern) identifying the workbook(s) to load.
Returns
Fluent interface to select a sheet for further Excel operations.

Implements GenerallyPositive.IAllowExcelFileSelection.

Definition at line 150 of file GPALExcel.cs.

◆ WithInsertPosition()

IAllowExcelCellSettings GenerallyPositive.GPALExcel.WithInsertPosition ( int position)

Sets where InsertValue(string) places its value relative to the current cell content: 0 inserts before the existing content, any other value inserts after.

Parameters
positionThe insert position (0 = before existing content, otherwise after).
Returns
Fluent interface to define cell-related settings or perform Excel operations.

Implements GenerallyPositive.IAllowExcelCellSettings.

Definition at line 1212 of file GPALExcel.cs.

◆ WithInsertSeparator()

IAllowExcelCellSettings GenerallyPositive.GPALExcel.WithInsertSeparator ( string separator)

Sets the separator that InsertValue(string) places between the inserted value and the cell's existing content. Defaults to a single space.

Parameters
separatorThe separator string to use.
Returns
Fluent interface to define cell-related settings or perform Excel operations.

Implements GenerallyPositive.IAllowExcelCellSettings.

Definition at line 1236 of file GPALExcel.cs.

◆ WithNewFile()

IAllowExcelSheetSelection GenerallyPositive.GPALExcel.WithNewFile ( GPALFile gpalFile)

Starts a workbook of the workflow's own at gpalFile , holding one sheet and nothing else. Nothing reaches the disk until SaveTo(GPALFile) or Close(bool) with true, the same as a workbook that was loaded.

Parameters
gpalFileThe name the workbook is to be saved under.
Returns
Fluent interface to pick or add a sheet.

Implements GenerallyPositive.IAllowExcelFileSelection.

Definition at line 211 of file GPALExcel.cs.

◆ WithNewSheet()

IAllowExcelOperations GenerallyPositive.GPALExcel.WithNewSheet ( string sheetName)

Adds a sheet named sheetName to every loaded workbook and works on it from here. A workbook already holding a sheet of that name keeps the one it has.

Parameters
sheetNameThe name for the new sheet.
Returns
Fluent interface to perform Excel operations on the new sheet.

Implements GenerallyPositive.IAllowExcelSheetSelection.

Definition at line 261 of file GPALExcel.cs.

◆ WithRange()

IAllowExcelOperations GenerallyPositive.GPALExcel.WithRange ( string range)

Reads the given cell range from the currently selected sheet of every loaded workbook and stores the data for use by subsequent operations (e.g. SaveTo(IGPALGrid<string>), WriteRange(string), comparisons). If a previous read/write operation has already been performed on this instance, prior range data and comparison differences are cleared first.

Parameters
rangeThe cell range to read (e.g. "A1:B10").
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelOperations.

Definition at line 458 of file GPALExcel.cs.

◆ WithRowNumber()

IAllowExcelOperations GenerallyPositive.GPALExcel.WithRowNumber ( int rowNumber)

Reads every value in the given row from the currently selected sheet of the first loaded workbook that has the selected sheet, storing the result (a single row of values) for use by subsequent operations. If a previous read/write operation has already been performed on this instance, prior range data and comparison differences are cleared first.

Parameters
rowNumberThe 1-based row number to read.
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelOperations.

Definition at line 716 of file GPALExcel.cs.

◆ WithSearchValue()

IAllowExcelSearchAndReplaceSettings GenerallyPositive.GPALExcel.WithSearchValue ( string value)

Sets the value to search for in subsequent ReplaceWith(string) operations.

Parameters
valueThe value to search for.
Returns
Fluent interface to define search-and-replace settings or perform Excel operations.

Implements GenerallyPositive.IAllowExcelOperations.

Definition at line 628 of file GPALExcel.cs.

◆ WithSheet() [1/2]

IAllowExcelOperations GenerallyPositive.GPALExcel.WithSheet ( int sheetIndex)

Selects the sheet at the given 1-based index for subsequent Excel operations on every loaded workbook.

Parameters
sheetIndexThe 1-based index of the sheet to select.
Returns
Fluent interface to perform Excel operations on the selected sheet.

Implements GenerallyPositive.IAllowExcelSheetSelection.

Definition at line 371 of file GPALExcel.cs.

◆ WithSheet() [2/2]

IAllowExcelOperations GenerallyPositive.GPALExcel.WithSheet ( string sheetName)

Selects the sheet with the given name (case-insensitive) for subsequent Excel operations on every loaded workbook.

Parameters
sheetNameThe name of the sheet to select.
Returns
Fluent interface to perform Excel operations on the selected sheet.

Implements GenerallyPositive.IAllowExcelSheetSelection.

Definition at line 413 of file GPALExcel.cs.

◆ WriteRange()

IAllowExcelOperations GenerallyPositive.GPALExcel.WriteRange ( string range)

Writes the range data previously read via WithRange(string) (or another data-producing operation) to range on the currently selected sheet of every loaded workbook.

Parameters
rangeThe destination cell range to write to (e.g. "A1:B10").
Returns
Fluent interface to perform further Excel operations.

Implements GenerallyPositive.IAllowExcelOperations.

Definition at line 518 of file GPALExcel.cs.


The documentation for this class was generated from the following file: