Read content from an Excel file via a .NET application

  • Thread starter Thread starter Bruce Schechter
  • Start date Start date
B

Bruce Schechter

I am looking for good documentation and preferably C#
sample code to show how to read content from an Excel
file via a .NET (Windows Form or ASP.NET) application.
I want to access the file via the Excel object model (for
Excel 2003) from my application. My .NET application
will provide a filename and location, open the excel
file, read content from specific locations within the
spreadsheet, then close the file.

I have searched MSDN and GotDotNet and seen documentation
for the Excel object model and several code samples. But
the paradigm seems to be different in most of these
examples, in that they are tuned for responding to events
when a user opens an Excel file, rather than the paradigm
being that my .NET application will proactively open an
Excel file.

I'm relatively new to C# and to .NET, so forgive me if my
question is not phrased in correct terminology.

Thanks for any help,
Cheers,
Bruce
 
Hello Bruce,

Thanks for posting in the group.

In MSDN, there are many articles on programming with Excel in Visual C#. I
am glad to include some here for your reference. They includes Windows
Forms and ASP.NET web forms application. Please refer to the following
articles:

"HOWTO: Automate Microsoft Excel from Microsoft Visual C# .NET"
http://support.microsoft.com/?id=302084

"HOWTO: Automate Excel With Visual C# .NET To Fill or Obtain Data In a
Range Using Arrays"
http://support.microsoft.com/?id=302096

"HOW TO: Transfer Data to an Excel Workbook by Using Visual C# .NET"
http://support.microsoft.com/?id=306023

"HOW TO: Transfer XML Data to Microsoft Excel 2002 by Using Visual C# .NET"
http://support.microsoft.com/?id=307029

"HOW TO: Query and Display Excel Data by Using ASP.NET, ADO.NET, and Visual
C# .NET"
http://support.microsoft.com/?id=306572

"HOW TO: Use ASP.NET to Query and Display Database Data in Excel by Using
Visual C# .NET"
http://support.microsoft.com/?id=311194

Hope that helps.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: "Bruce Schechter" <[email protected]>
!Sender: "Bruce Schechter" <[email protected]>
!Subject: Read content from an Excel file via a .NET application
!Date: Wed, 8 Oct 2003 13:38:45 -0700
!Lines: 25
!Message-ID: <[email protected]>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcON3CtiLYSUuwl9SjqzOeCfypo23w==
!Newsgroups: microsoft.public.dotnet.framework
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework:55736
!NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
!X-Tomcat-NG: microsoft.public.dotnet.framework
!
!
!I am looking for good documentation and preferably C#
!sample code to show how to read content from an Excel
!file via a .NET (Windows Form or ASP.NET) application.
!I want to access the file via the Excel object model (for
!Excel 2003) from my application. My .NET application
!will provide a filename and location, open the excel
!file, read content from specific locations within the
!spreadsheet, then close the file.
!
!I have searched MSDN and GotDotNet and seen documentation
!for the Excel object model and several code samples. But
!the paradigm seems to be different in most of these
!examples, in that they are tuned for responding to events
!when a user opens an Excel file, rather than the paradigm
!being that my .NET application will proactively open an
!Excel file.
!
!I'm relatively new to C# and to .NET, so forgive me if my
!question is not phrased in correct terminology.
!
!Thanks for any help,
!Cheers,
!Bruce
!
!
 
Back
Top