Link to home
Start Free TrialLog in
Avatar of sarad122
sarad122

asked on

How to create .xlsx file in C# using Microsoft.ACE.OLEDB.12.0 without installing Microsoft Access Data Engine on the server?

How to create a .xlsx file in C#. I am using Microsoft.ACE.OLEDB.12.0. On my local machine it is working fine. When I deploy the same code to server, its not working. Microsoft.ACE.OLEDB.12.0 is not registered on the server. Issue is not to install anything on the server. Please let me know how to fix the below attached code, creating .xlsx file without installing any exe on the server. I can include .dll with the the code that fix this issue?
code.docx
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

If no installation is possible probably is better to create a .CSV file to feed to the users.

Simple.  Create the file on your PC then copy the file to the server.  No need to install anything on the server and you can create the file you need locally you have said.

Avatar of sarad122
sarad122

ASKER

I need to execute Sql server job on the server. Job uses a package. Package contains Script task written in c#. the script task reads data from sql server and store it in .xlsx file. I cannot change the file extension. File extension should be .xlsx
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Any other way to create .xlsx file?

Can you install anything on the server?  (eg Microsoft Office)

I don't know if this is of some help : https://github.com/JanKallman/EPPlus

It is supposed to create Excels (.xlsx) based on the fact that .xlsx is actually XML files.

Without touching the server, beside a file transfer, nohing else.

For data integration, I would suggest you to use Pentaho Data Integration(PDI).

It can handle most of the data file format(inport/export,handling...).

Also, you can set up schedule job with command line in Schedule Task.

Hi Sarad,


Please post your code using the Code tool. I do not think you need to do anything on the server with OleDB if you are only interested in generating an excel file.


I have some PAQ, I think you might want to look at them.


https://www.experts-exchange.com/questions/29125639/Writing-to-excel-via-Excel-Interop.html#a42730618


Please note that Microsoft Open XML SDK is the best solution if you are looking at a server based solution BUT it is pretty complex and can induce a severe headache if you need to perform fancy operations with the file.


Another advantage of Open XML SDK is it can generate anything from the ***X family i.e. DOCx, PPTx, XSLx and that too without having any interops on the server.


Also, you have an open question where I have already listed these libraries. Please have a look:

https://www.experts-exchange.com/questions/29172990/How-to-create-xlsx-file-in-c.html#a43032372


Regards,

Chinmay.