I am reading a specific column in an excel file and trying to change values in it. The file has records like the following
12345*5
12445*6
12312*9
I want to replace the '*' with '_'.
I get the following error 'Cannot implicitly convert type 'object[*,*]' to 'string[*,*]'. An explicit conversion exists (are you missing a cast?)'
I have looked the error online but have not been able to fix this error.
    static void Main(string[] args)
    {
        var xlApp = new Excel.Application();
        var xlWorkbook = xlApp.Workbooks.Open(@"path");
        var xlWorksheet = xlWorkbook.Sheets[1];
        Excel.Range xlRange = xlWorksheet.UsedRange;
        ChangeValue(xlWorksheet);
    }
    private static void ChangeValue(Excel.Worksheet oWorksheet)
    {
        var colNo = oWorksheet.UsedRange.Columns.Count;
        var rowNo = oWorksheet.UsedRange.Rows.Count;
        string[,] array = oWorksheet.UsedRange.Value;
        for (var j = 1; j <= colNo; j++)
        {
            for (var i = 1; i <= rowNo; i++)
            {
                if (array[i, j] == "Number Field")
                {
                    for (var m = i + 1; m < rowNo; m++)
                    {
                        if(array[m, j].Contains('*'))
                        {
                            array[m, j].Replace('*', '_');
                        }
                    }
                    oWorksheet.UsedRange.Value = array;
                    return;
                }
            }
        }
    }
 
     
     
     
    