Created
February 15, 2020 02:40
Star
You must be signed in to star a gist
Find and Replace Text in Excel - Aspose.Cells for .NET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load Excel workbook | |
Workbook workbook = new Workbook("Excel.xlsx"); | |
ReplaceOptions replace = new ReplaceOptions(); | |
// Set case sensitivity and text matching options | |
replace.CaseSensitive = false; | |
replace.MatchEntireCellContents = false; | |
// Set RegexKey to true to indicate that the searched key is a Regex | |
replace.RegexKey = true; | |
// Replace text | |
workbook.Replace("\\bKIM\\b", "^^^TIM^^^", replace); | |
// Save updated Excel workbook | |
workbook.Save("Updated Excel.xlsx"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load Excel workbook | |
Workbook workbook = new Workbook("Excel.xlsx"); | |
ReplaceOptions replace = new ReplaceOptions(); | |
// Set case sensitivity and text matching options | |
replace.CaseSensitive = false; | |
replace.MatchEntireCellContents = false; | |
// Replace text | |
workbook.Replace("find and replace this text","with this text", replace); | |
// Save updated Excel workbook | |
workbook.Save("Updated Excel.xlsx"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment