Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F# or C# based Excel add-in on OSX

I have some handy Excel add-ins running under Excel on Windows and I would really like to produce versions of the add-ins that will work with Excel on OS X. Under Windows I use the fantastic Excel-DNA package to allow me to invoke my .Net based logic from VBA. However, on my Mac I'm really struggling to even find a start point when it comes to writing, packaging, deploying and then calling a C# or F# based add-in.

Alternatively is there some non-VBA I can rewrite my add-ins so they will run on both Windows and OSX? I'm open to Scala, Python or anything else that gives me the desired portability.

I can see a post on here from 2011 and so I'm writing in the hope that things have progressed since the last query of this type in 2011.

like image 766
Keith Avatar asked Mar 21 '23 08:03

Keith


2 Answers

The development language, and whether or not you use Mono (to run C#/F#), is not really at issue. If there were some support for native (xll-style) add-ins in Excel for Mac, it would be possible to bind that to anything else, as I've done with Excel-DNA under Windows. Ancient (pre-OS X) versions of Excel for Mac did support native .xlls, but I have found no documentation or evidence that this is still supported.

Binding from VBA to external code, in the style of COM or Declare Function might be possible - certainly you can use Declare Function to call .dylib libraries (I say that based solely on this SO answer). So that gives you one direction to explore, and Xamarin for Mac might allow you to create native libraries that will work with Declare in C#/F#.

I have never been able to find much documentation for Excel for Mac online, which rather discourages further effort.


All this is a long way to say that for power users, Excel is pretty much Windows-only. Your efforts are probably best spent exploring virtual machine or dual-booting set ups.

I'd welcome any information to the contrary.

like image 54
Govert Avatar answered Mar 22 '23 22:03

Govert


I have solved this problem with ExcelDNA. As stated in the ExcelDNA forums it does not support Mac for Office, however there is a workaround. Install Wine for OSX and then run Microsoft Office 2003 or 2010 within it. I used a commercial distribution of Wine called Crossover and it works well. The downside of this approach is that you must install Wine on every target for your AddIn.

The Excel AddIn I created is Excel-REPL.

like image 22
Matthew Molloy Avatar answered Mar 22 '23 23:03

Matthew Molloy