Lost formulas on openpyxl-ccr 1.6.2

89 views
Skip to first unread message

Martin Wolden

unread,
Jul 26, 2013, 5:16:45 AM7/26/13
to openpyx...@googlegroups.com
First of all a big thanks to Charlie for this version. It is exectly what I'm after.

I just encounter one issue, I have made a GUI for writing to a excisting sheet.
The values go in column 1 and there are formulas in the second column to show
the total as you add values to column 1. The problem is that this formulas are 
kept only in the top two rows and some random rows below.

Here's the code i test with.

def on_s_s_button_clicked(self, widget, data=None):
        self.range_tbutton = self.builder.get_object('range_tbutton')
        if self.range_tbutton.get_active():
           wb = load_workbook(filename = 'r3pu.xlsx', use_iterators=False)
           ws = wb.worksheets[0]
           ws.cell('B14').value = 9.74
           ws.cell('B15').value = 9.59
           ws.cell('B30').value = 9.69
           ws.cell('B31').value = 9.49 
          
        wb.save('/home/martin/arto_pu/putally.xlsx')
        print 's_s_button clicked' 

Attached is the output file, hopefully it explains better than my poor english!

Any help greatly appreciated.

Martin
 
putally.xlsx

Charlie Clark

unread,
Jul 28, 2013, 9:04:32 AM7/28/13
to openpyx...@googlegroups.com
Hiya,

Am 26.07.2013, 11:16 Uhr, schrieb Martin Wolden <wol...@gmail.com>:

> First of all a big thanks to Charlie for this version. It is exectly what
> I'm after.

er, does that mean you are using my fork (in which case I'm very happy to
hear that it's sort of working for you)? Or has it already been merged
back into trunk?

> I just encounter one issue, I have made a GUI for writing to a excisting
> sheet.
> The values go in column 1 and there are formulas in the second column to
> show
> the total as you add values to column 1. The problem is that this
> formulas
> are
> kept only in the top two rows and some random rows below.
> Here's the code i test with.
> def on_s_s_button_clicked(self, widget, data=None):
> self.range_tbutton = self.builder.get_object('range_tbutton')
> if self.range_tbutton.get_active():
> wb = load_workbook(filename = 'r3pu.xlsx',
> use_iterators=False)
> ws = wb.worksheets[0]
> ws.cell('B14').value = 9.74
> ws.cell('B15').value = 9.59
> ws.cell('B30').value = 9.69
> ws.cell('B31').value = 9.49
> wb.save('/home/martin/arto_pu/putally.xlsx')
> print 's_s_button clicked'
> Attached is the output file, hopefully it explains better than my poor
> english!

I'm not sure it does. The best thing is to submit a bug report either to
trunk or to my fork, if that is what you are using. Please add the
original file and some simple Python code illustrating what you are
changing and explain what you expect to see.

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel: +49-211-600-3657
Mobile: +49-178-782-6226

Martin Wolden

unread,
Jul 28, 2013, 3:45:11 PM7/28/13
to openpyx...@googlegroups.com
Hi again!

Yep, I'm using your fork. I'm not to experienced in programming and openpyxl, so I thought I'd ask it as a
question here before I reported anything to be a bug. The reason I didn't attach the input file is that it's 
kind of "Lincenced" by a company and I didn't want to do anything stupid. If it's an option I could send 
it to you so you can look at it.

As for the issue, column "B" is where I input my values, in column "C" every cell (from row 14 and down) 
should contain a formula that shows you the total of the values entered in column "B" (from 14 and down). 
It keeps these formulas in row 14,15 and for some reason 38.

The cells in column "D" and "E" show the total pluss whatever number you enter in cells "E11" and "E12"
It's just strange to me how it keep the formulas in the two first rows then skips about 23 rows before it keeps
them in row 38. 


Hope that explains a bit better, if you think it should be reported as a bug to your fork I will do that.

By the way, if I use any other version/fork I lose all formulas + most of the style/formatting. Keeping these
formulas is the last piece of the puzzle for my application.

Thanks

Martin

Charlie Clark

unread,
Jul 28, 2013, 4:52:22 PM7/28/13
to openpyx...@googlegroups.com
Am 28.07.2013, 21:45 Uhr, schrieb Martin Wolden <wol...@gmail.com>:


> Hi again!
> Yep, I'm using your fork. I'm not to experienced in programming and
> openpyxl, so I thought I'd ask it as a
> question here before I reported anything to be a bug. The reason I didn't
> attach the input file is that it's
> kind of "Lincenced" by a company and I didn't want to do anything stupid.
> If it's an option I could send
> it to you so you can look at it.

That's understood. But it probably doesn't need to be exactly the same
file. If you prefer you can send me the file but, for a test-case it
shouldn't really matter unless there are other things happening in the
file.

> As for the issue, column "B" is where I input my values, in column "C"
> every cell (from row 14 and down)
> should contain a formula that shows you the total of the values entered
> in
> column "B" (from 14 and down).
> It keeps these formulas in row 14,15 and for some reason 38.

> The cells in column "D" and "E" show the total pluss whatever number you
> enter in cells "E11" and "E12"

They are empty and I also see some division by zero errors from C5::C9.
Not sure if that's relevant.

> It's just strange to me how it keep the formulas in the two first rows
> then
> skips about 23 rows before it keeps
> them in row 38.

Indeed. We'll have to investigate.

> Hope that explains a bit better, if you think it should be reported as a
> bug to your fork I will do that.

Please do. Eric has recently been working his way through pull requests
but mine are bigger than most it seems.

> By the way, if I use any other version/fork I lose all formulas + most of
> the style/formatting.

Yes, well, as discussed with Augusto Men, it's difficult to know at the
moment what you is right when reading cells with formulae: preserve the
formula or the value? if you can only preserve one.
Reply all
Reply to author
Forward
0 new messages