We help IT Professionals succeed at work.

c# Accessing office files without installing office

rciner313
rciner313 asked
on
Can i modify an Excel file located on a network drive using C# if the computer running the program does not have Office installed?
Comment
Watch Question

AndyAinscowFreelance programmer / Consultant

Commented:
What do you mean modify?

It can be opened as any other binary file and read/written to.  

If you want to run Excel commands (eg. automation) then no - you would need excel installed on the PC to do that.
Praveen KumarArchitect

Commented:
Its pretty hard implement. or you can choose any third party tool such as aspose.
Ex:
http://www.aspose.com/categories/.net-components/aspose.cells-for-.net/default.aspx

Commented:
If you plan to automate Excel to edit excel files using the office interop then you have to have excel installed on the computer running the program. You can, alternatively, use C# to create properly formatted XML files that excel will recognize and open up automatically. Here's a good example: http://stackoverflow.com/questions/150339/generating-an-excel-file-in-asp-net
Top Expert 2009

Commented:
If cost / licensing is the reason why you don't have Office installed, then you might want to try Star Office (free) and try modifying the excel file.

Arun
Todd GerbertSenior Engineer
Top Expert 2010

Commented:
You can get at the data using an OleDbConnection.
You won't be able to modify the formatting of the document or formulas.
Éric MoreauSenior .Net Consultant
Top Expert 2016

Commented:
I second the Aspose component. I have been using it for years now and it is a great addition to my toolset.

Commented:
Top Expert 2010
Commented:

You can use Jet OLE DB Provider. Below links have very good examples.

http://www.davidhayden.com/blog/dave/archive/2006/05/26/2973.aspx

http://support.microsoft.com/kb/316934