I have a challenging problem that is described in this post on
SuperUser:
http://superuser.com/questions/367201/how-can-i-count-unique-comma-seperated-values-in-excel-2010
The nature of the problem is difficult to solve with excel formulas,
but rather easy to solve if you can define your own user functions in
VBA (as suggested in Chris Neilsen's answer).
If someone has thoughts on how we could add VBA user defined formulas
into openpyxl, I would value your input on how we could make it
happen.
Cheers,
Hi David,
I guess you have good reasons not to make the calculation in python and just write the result in another cell :)
To be honest,I never tried to put vba in an openpyxl workbook,and I can't estimate the cost of adding such a feature for now,but I assume the effort would be quite big :/
If you need a quick solution for your problem,you'd better go with the insane Excel formula as answered on SU :) if you have more time in your hands,then you can file a ticket on the bugtracker and I can make some research on the topic,but I have many critical stuff to fix before :(
Cheers,
Eric
On Dec 14, 1:54 am, Eric <eric.gaz...@gmail.com> wrote:
> Hi David,
> I guess you have good reasons not to make the calculation in python and
> just write the result in another cell :)
>
Correct, other people will consume this spreadsheet and want to modify
it themselves after it has been "compiled" from multiple sources. If
I must compile a new spreadsheet every time someone wants to modify a
cell, then that's not going to work in anything other than a small
office
> To be honest,I never tried to put vba in an openpyxl workbook,and I can't
> estimate the cost of adding such a feature for now,but I assume the effort
> would be quite big :/
>
> If you need a quick solution for your problem,you'd better go with the
> insane Excel formula as answered on SU :) if you have more time in your
> hands,then you can file a ticket on the bugtracker and I can make some
> research on the topic,but I have many critical stuff to fix before :(
>
Well I was hoping to contribute some code, even if in a private branch
assuming someone understood the scope of the problem. I could use the
formulas, but that solution is only marginally acceptable in the
situation that someone adds another value in the comma-separated list.
Apparently, VBA is compiled in Excel in a proprietary binary format, and is not part of the OOXML specification (assumptions based on http://techrights.org/2007/01/11/proprietary-open-xml-extensions-already/, have not checked the specs to confirm, but this seems highly probable).
Hope it will get you started, let me know if you need more help ;-)
Cheers,
Eric
Am .08.2015, 22:25 Uhr, schrieb John Bovey <J.D....@kent.ac.uk>:Possibly the problem is in the workbook.xml.rels file. In Filipe's
version of openpyxl the type for target vbaProject is:
http://schemas.openxmlformats.org/officeDocument/2006/relationships/vbaProject
In the current branch 2.3 it is
http://schemas.microsoft.com/office/2006/relationships/vbaProject
That's certainly possible. I did have to make some changes around that
when moving the code to the more declarative form. However, I can't debug
what I don't have.
Filipe - replying to an e-mail from 2011 without consulting the
documentation which explains how VBA is supported was not very helpful. If
you think there is a bug in the library then please submit a bug report
detailing which version you are using and providing a sample file.
Charlie
Am .08.2015, 13:59 Uhr, schrieb John Bovey <J.D....@kent.ac.uk>:Filipe's code is ok, as is the latest version of the openpyxl code. He
just needs to get the latest version. I just was not sure of the best
way for him to do that.
You mean there is a bug in the 2.3-b1 ? and/or 2.2.5 ?
You can always use a branch checkout with pip:
bin/pip install -e
hg+https://bitbucket.org/openpyxl/openpyxl@2.3#egg=openpyxl
2.3-b2 and 2.2.6 are scheduled for release as soon as Eric has the time.
Charlie