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
.NET ProgrammingC#Microsoft AccessMicrosoft SQL ServerMicrosoft Excel

Avatar of undefined
Last Comment
Chinmay Patel

8/22/2022 - Mon
John Tsioumpris

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

AndyAinscow

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.

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
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER CERTIFIED SOLUTION
AndyAinscow

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
sarad122

ASKER
Any other way to create .xlsx file?
AndyAinscow

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

John Tsioumpris

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.

⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Fabrice Lambert

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

Benjamin Lu

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.

Chinmay Patel

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.

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck