An Excel application can be regarded as a COM server, so the basis of interoperation between C# and Excel applications is COM Interop. When you create a new Office project, Visual Studio adds references to the PIAs that are required to build the project.įor Excel to be used in C# applications, we need to resolve the issue of interoperation between C# and Excel. During Visual Studio installation, the PIAs are automatically installed in a local file system. The PIA enables managed code to interact with a Microsoft Office application’s COM-based object model. NET application, a developer must use the primary interop assembly (PIA). To use the features of a Microsoft Office application from your. But, in this tutorial we will use the COM library because it’s already available in your system if Microsoft Office is installed. There are a number of free third-party libraries available for handling Microsoft Excel files in C#. NET where we need to do lot of report generation from Microsoft Excel. This tutorial will be very useful for developers working on Desktop and Web applications using Visual Studio.
In this tutorial, I will explain with code snippets how to plot a graph from the data in Excel sheet, and export a chart from Excel sheet through C# and save it locally. Microsoft Office Excel Object Library, commonly known as Microsoft Office Interop Object, can help developers generating and exporting report from Microsoft Excel.