Maybe, if I could figure out what you are asking. Sorry for being more
obtuse than normal, but it's been about 40 degrees Celsius here and
rolling power cuts have forced me to take the palantir offline.
By "pivot table" do you mean a static "crosstab", or something like the
PivotTable (TM) of Microsoft Excel, which is a dynamic gadget that the
user can manipulate?
Why "create a PT *from* a spreadsheet? Do you mean "create a PT and
insert into a spreadsheet"?
What is, and what is the relevance of, "dynamically generated"?
Cheers,
John
Thanks for the clarification.
At the moment the prime candidate would be driving Excel via COM. A
distant second would be using pyUNO to script OpenOffice's Calc -- among
other contraindications may well be that their "DataPilot" (no TM AFAIK)
doesn't have the same functionality as MS's PivotTable (TM).
Cheers,
John
On 2/02/2009 8:32 AM, Ana Nelson wrote:
> Okay, I got ahead of myself and was thinking you could write VB macro
> pages into workbooks but that's not possible at this point.
Some developers have interesting reactions to suggestions like that.
Here's one example. Fire up a Python interactive prompt, and type:
from __future__ import braces
:-)
> You could put the macro into a separate workbook, and it would be
> available to your users as long as macros.xls was open when they open
> my-xlwt-workbook-filled-with-yummy-data.xls
>
> macros.xls can just have the macro linked to a keyboard shortcut, and
> then you can have instructions for your users in the xlwt book which
> say "make sure you have macros.xls open, then type ctrl+shift+p (or
> whatever) to create a pivot table".
Not a big jump from that to training the users to create the pivot table
themselves.
On Jan 31, 8:13 pm, erikcw <erikwickst...@gmail.com> wrote:
>>>> End users need to be able to manipulate the pivot table themselves.
Need or want? Earlier you said it was to manipulate the data. Can you
please be a little more specific? Does it involve anything more
complicated than a two-way cross-tabulation of ony one variable e.g.
"give me total revenue tabulated by region and product type"?
Does manipulate possibly mean neither "change the data" nor "fiddle with
the pivot table mechanism" but something like "add some extra
columns/rows with formulas" to get some extra statistics? In that case
you can put one or more cross-tabulations plus a bunch of formulas in
the output file with xlwt. Or forget the formulas and just calculate
results in Python.
One disadvantage of an in-Excel PivotTable (TM) is that all of the
underlying data (needs to be | is) carried around ... with a secondary
effect that often user changes seem to take a long time.
Patrick Waldo mentioned the SimplePivotTable gadget (really just a 2-way
crosstab gadget) that I lashed up a while back in response to his
question. Then it was "tested as much as you see"; now it has been
battle-hardened in scenarios like I described above. Anyone want a copy?
Is this a canidate for inclusing in xlutils?
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk