Sometime you need to Create Excel File without Using Excel COM Object, at that time best solution is using EPPLUS. Below article we are talk how to Open Excel File and Do the Changes Using EPPLUS
Contents
Introduction: Embracing EPPlus for Excel File Manipulation
In the realm of Excel file manipulation, EPPlus stands out as a versatile and powerful tool. Its capability to seamlessly handle Excel files using C# makes it a favorite among developers. In this guide, we delve into the intricacies of EPPlus, exploring how it can be leveraged to open and modify Excel files efficiently.
Understanding EPPlus: A Brief Overview
EPPlus is a robust open-source library for dealing with Excel files programmatically in C#. It eliminates the need for complex Excel Interop COM objects, offering a simpler and more efficient approach to Excel file manipulation. By leveraging EPPlus, developers can perform various tasks such as reading, writing, and modifying Excel files with ease.
Example: Open Excel File and Do the Changes Using EPPLUS
First you need to Add EPPLUS DLL
using OfficeOpenXml;
private void createExcelReport() {
string workbookPath = “c:/AAA.xlsx”;
FileInfo newFile = new FileInfo(workbookPath);
ExcelPackage excelPackage = new ExcelPackage(newFile);
var ws = excelPackage.Workbook.Worksheets[1];
ws.Cells[2, 3].Value = “Value 1”;
ws.Cells[3, 3].Value = “Value 2”;
excelPackage.Save();
}
Conclusion
In conclusion, EPPlus emerges as a game-changer in the realm of Excel file manipulation. Its intuitive API, coupled with powerful functionalities, makes it the go-to choice for developers seeking to automate Excel-related tasks. By mastering EPPlus, developers can unlock new possibilities and streamline their workflow effectively. Embrace EPPlus today and elevate your Excel file manipulation to new heights!