private static int GetMergedRowRange(this ExcelRange excelRange) { var range = excelRange.GetMergedRangeAddress(); var regex = new Regex(@"([a-zA-Z]+)(?<startIndex>[\d]+):([a-zA-Z]+)(?<endIndex>[\d]+)"); var match = regex.Match(range); if (match.Groups.Count > 1) { var startIndex = int.Parse(match.Groups["startIndex"].Value); var endIndex = int.Parse(match.Groups["endIndex"].Value); return(endIndex - startIndex); } return(0); }