public static ExcelRange WriteData(this ExcelRange range, object[,] data) { var result = range; if (isRangeSizeValid(range, data) == false) { result = range.GetRangeForSize(data.GetLength(yLengthIndex), data.GetLength(xLengthIndex)); } result.SetValue(data); return(result); }