Excel IF function is not recognized by the Excel
Created originally on Bitbucket by Anonymous
The code:
#!python
from openpyxl import Workbook
wb = Workbook()
fileName = r'test.xlsx'
ws = wb.worksheets[0]
ws.title = "test"
ws.cell('A1').value = '=sqrt(4)'
ws.cell('A2').value = '=if(A1<4;-1;1)'
ws.cell('A3').set_value_explicit(value='=if(A1<4;-1;1)', data_type='s')
ws.cell('A4').set_value_explicit(value='=if(A1<4;-1;1)', data_type='f')
wb.save(filename = fileName)
is not working properly when the test.xlsx is opened and the messge is shown:
#!xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error079920_01.xml</logFileName><summary>In file »C:\Users\...\test.xlsx« there were errors found</summary><removedRecords summary="List of removed records:"><removedRecord>Removed records: Formula from the part /xl/worksheets/sheet1.xml</removedRecord></removedRecords></recoveryLog>
openpyxl: 1.6.2 portable-python: 2.7.5.1 excel: 2013
Attachments: excel_if.xlsxbroken_if.xlsx