how to read a excel file in c#.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rohitkumar
    New Member
    • Aug 2007
    • 17

    how to read a excel file in c#.net

    i have to read a excel file in fornt end essentially in asp/c#.net.
    the row column value from the excel file has to be assigned to c# variable for further processing. i wanna know how to open connection to read the file and data.
  • vinci
    New Member
    • Aug 2006
    • 62

    #2
    Originally posted by rohitkumar
    i have to read a excel file in fornt end essentially in asp/c#.net.
    the row column value from the excel file has to be assigned to c# variable for further processing. i wanna know how to open connection to read the file and data.

    hi! welcome to TSDN!

    u can access data from excel by using Microsoft.Offic e.Interop.Excel assembly..

    u can research about this assembly and how to use it...

    hope it helps!

    Comment

    • buhnik
      New Member
      • Aug 2007
      • 2

      #3
      [You have to uesd
      using Excel1 = Microsoft.Offic e.Interop.Excel ;
      Excel1.Applicat ion m_KeletoXL;
      Excel1.Workbook m_KeletexcelWor kbook;
      Excel1.Workshee t m_KeletoSheet;
      Excel1.Range m_KeletRange;
      Array m_myvalues;
      m_oSheet[IndexShett].get_Range(rowS tart, rowEnd).Font.Bo ld = true;
      m_oSheet[IndexShett].get_Range(rowS tart, rowEnd).Font.Co lor = ColorTranslator .ToWin32(m_Colo rNumberOfProfil es[IndexShett]);

      Comment

      • rohitkumar
        New Member
        • Aug 2007
        • 17

        #4
        Originally posted by vinci
        hi! welcome to TSDN!

        u can access data from excel by using Microsoft.Offic e.Interop.Excel assembly..

        u can research about this assembly and how to use it...

        hope it helps!
        i m trying to declare an object of Application type using the code as below
        Code:
        Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application()
        it's giving me following error
        UnauthorizedAcc essException was handled
        i tried resolving it by DCOMCNFG to set an ASPNET account,still i m getting the same error.
        what to do/

        Comment

        Working...