Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an alternative library to Microsoft.Office.Interop.Excel?

Tags:

c#

excel

I am using the Microsoft.Office.Interop.Excel reference in order to have some manipulations with excel files, like adding columns, locking cells, protecting with password etc...

Now I have to use this code on a server that doesn't have office installed on it, so I don't really know for sure if the code using this reference will be able to run there. So is there a way of doing all these actions on excel files on a server that doesn't have office installed on it ? Should I use another library or is there a way that the Microsoft.Office.Interop.Excel reference to work with no office installed ?

like image 312
Liran Friedman Avatar asked Mar 22 '15 12:03

Liran Friedman


People also ask

How can I read Excel file in C# without using Microsoft Office Interop Excel libraries?

using (ExcelPackage xlPackage = new ExcelPackage(existingFile)) { // get the first worksheet in the workbook ExcelWorksheet worksheet = xlPackage. Workbook. Worksheets[1]; int iCol = 2; // the column to read // output the data in column 2 for (int iRow = 1; iRow < 6; iRow++) Console. WriteLine("Cell({0},{1}).

Do I need to have Office installed to use Microsoft Office Interop Excel DLL?

Yes, you are right. You need Excel to be installed to use the Excel Manipulation feature with Microsoft. Office. Interop.


1 Answers

You can use EPPlus. It works with Open Office Xml format. No need to install any Office component on the server. https://github.com/EPPlusSoftware/EPPlus

like image 115
Baran Avatar answered Nov 01 '22 11:11

Baran