'Error upon inserting excel formula from Python to excel tab

So I was asked to insert this formula to each tab in excel. Problem is caused by "=" because if I remove "=" from below code it works just fine.

I use library openpyxl

page['%s%s' % (slownik['transport cost per m3'], str(k))] = "=JEŻELI.BĄŁD(" + slownik['price per truck'] + str(k) + "/" + \
                                                            slownik['m3 per truck'] + ")" + str(k)

I got an error and excel breaks.

This below works just fine.

page['%s%s' % (slownik['transport cost per m3'], str(k))] = "JEŻELI.BĄŁD(" + slownik['price per truck'] + str(k) + "/" + \
                                                                slownik['m3 per truck'] + ")" + str(k)


Solution 1:[1]

Okay so. First of all formula should be done in english. Also In formula I shouldn't use ";" I should use:"," So in the end formula inside python looks like this:

page['%s%s' % (slownik['transport cost per m3'], str(k))] = "=IFERROR(" + slownik['price per truck'] + str(k) + "/" + slownik['m3 per truck'] + str(k) + ",0)"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Patryk