Search and Replace Data in a Range

Aspose.Cells provides the FindOptions.setRange() method for specifying a range when searching for data.

Suppose you want to search for the string “search” and replace it with “replace” in the range E3:H6. In the screenshot below, the string “search” can be seen in several cells but we want to replace it only in a given range, here highlighted in yellow.

Input file

todo:image_alt_text

After the execution of the code, the output file looks like the below. All “search” strings within the range have been replaced with “replace”.

Output file

todo:image_alt_text

  • Find or Search Data