Discussion:
[Rdkit-discuss] Announce: RDKit for Excel.
Jan Holst Jensen
2017-06-18 18:06:46 UTC
Permalink
Hi RDKitters,

I am happy to announce an open source Excel add-in that gives easy
access to the RDKit Python API. The add-in is BSD-licensed like RDKit.
https://github.com/janholstjensen/rdkit4excel

Screenshot of the add-in running in Excel 2016 (note: molecule rendering
requires additional 3rd party software):


The add-in is easily extendable via pure Python scripting. A new Excel
function is added by adding a function to the CRDKitXL Python class and
annotating the new function's input/output parameter types through
structured comments. For example, adding an "rdkit_SmilesToMolBlock()"
function that has a single "smiles" string input parameter:

#RDKITXL: in:smiles:str, out:str
def rdkit_SmilesToMolBlock(self, smiles):
# Python function implementation follows here...


Many thanks to Esben Jannik Bjerrum who did the implementation of this
first version.

Cheers
-- Jan Holst Jensen
Curt Fischer
2017-06-19 16:40:20 UTC
Permalink
This is great! Thanks Jan.

I haven't tried it yet, but based on the GitHub README it looks like this
is only for Excel on a Windows box. Is that right, or can Mac versions of
Excel also work? And since it's come up on the mailing list recently, is
there a plan to expand to/move to Python 3 at any point soon?

Curt
Post by Jan Holst Jensen
Hi RDKitters,
I am happy to announce an open source Excel add-in that gives easy access
to the RDKit Python API. The add-in is BSD-licensed like RDKit.
https://github.com/janholstjensen/rdkit4excel
Screenshot of the add-in running in Excel 2016 (note: molecule rendering
The add-in is easily extendable via pure Python scripting. A new Excel
function is added by adding a function to the CRDKitXL Python class and
annotating the new function's input/output parameter types through
structured comments. For example, adding an "rdkit_SmilesToMolBlock()"
#RDKITXL: in:smiles:str, out:str
# Python function implementation follows here...
Many thanks to Esben Jannik Bjerrum who did the implementation of this
first version.
Cheers
-- Jan Holst Jensen
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Jan Holst Jensen
2017-06-19 17:43:04 UTC
Permalink
Hi Curt,

The add-in is based on COM automation services, so it is Windows-only to
the best of my knowledge. We chose to implement it as a COM service
since the Python code was then extremely simple and very easy to extend.

I don't have access to a Mac so I am having a hard time figuring out if
MS Office on Mac implements enough of the COM subsystem to support COM
automation servers. It might be that both Mac and Windows could be
supported if the add-in was written in C++ as an XLL. My gut feeling is
that it would then be harder to extend dynamically, but I could be
wrong. One thing I do know is that it would be more complex to write.

To support both Windows and Mac you can also take the approach that
xlwings has taken where a DLL is loaded by VBA code and talks to the
Python code:
https://www.xlwings.org/

We initially tried to base our add-in on xlwings but got into trouble
sharing Excel worksheets with User Defined Functions. The UDFs in
xlwings are made available to Excel through VBA auto-generated from the
Python code. Smart concept, but gets us into trouble using UDFs in
sheets that are passed around or copied.

Python 3 - yes, we should go there. If the COM support that the add-in
relies on is available in Python 3 it should be straightforward (famous
last words :-) ). Hopefully I will have some time to check this out over
the summer.

Cheers
-- Jan
Post by Curt Fischer
This is great! Thanks Jan.
I haven't tried it yet, but based on the GitHub README it looks like
this is only for Excel on a Windows box. Is that right, or can Mac
versions of Excel also work? And since it's come up on the mailing
list recently, is there a plan to expand to/move to Python 3 at any
point soon?
Curt
On Sun, Jun 18, 2017 at 11:06 AM, Jan Holst Jensen
Hi RDKitters,
I am happy to announce an open source Excel add-in that gives easy
access to the RDKit Python API. The add-in is BSD-licensed like RDKit.
https://github.com/janholstjensen/rdkit4excel
<https://github.com/janholstjensen/rdkit4excel>
Screenshot of the add-in running in Excel 2016 (note: molecule
The add-in is easily extendable via pure Python scripting. A new
Excel function is added by adding a function to the CRDKitXL
Python class and annotating the new function's input/output
parameter types through structured comments. For example, adding
an "rdkit_SmilesToMolBlock()" function that has a single "smiles"
#RDKITXL: in:smiles:str, out:str
# Python function implementation follows here...
Many thanks to Esben Jannik Bjerrum who did the implementation of
this first version.
Cheers
-- Jan Holst Jensen
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
<https://lists.sourceforge.net/lists/listinfo/rdkit-discuss>
Loading...