I have done something like that.
There are 2 ways to follow, 1 is using the free libraries that exist on the internet and the other is through COM objects using the language you want.
In my case I have used COM on Windows servers with Excel installed.
I tried to do it through the free libraries available on the internet but none of them work, at least not the versions I downloaded.