Reading theI have created a class for reading data from an Excel sheet and holding on the variable in C# and I have created the class that read from Excel but I. I am not sure Ifif my code is optimized, meaning I will be reading heavyheavily from excelExcel.
Is there a room to further optimized this code more?, I I will be using this class heavyheaving in my code, and thoughtI wanted to get some opinionopinions/feedback -.
I will be calling something like this...:
ExcelReader xl = new ExcelReader();
string sss = xl.ExcelOpenSpreadsheets("mysheet");
//etc...
public class ExcelReader  
{             
    Application _excelApp;
    
    public ExcelReader()
    {
        _excelApp = new Application();
    }
    
    public string ExcelOpenSpreadsheets(string sheetName)
    {
        string _txt = string.Empty;
        try
        {
            Workbook workBook = _excelApp.Workbooks.Open("filename_here",....);
            _txt = ExcelScanIntenal(workBook, sheetName);
        }
        
        catch
        {
            //
            // Deal with exceptions.
            //
        }
        return _txt;
    }
    
    private string ExcelScanIntenal(Workbook workBookIn, string sheetName)
    {
        Worksheet sheet = workBookIn.Sheets[sheetName] as Worksheet;
        
        Range a1 = sheet.get_Range("A1", "B2");
        if (a1 != null)
        {
            string formattedText = r.Text;                   
        }
        
        return formattedText; 
    }