2

I have an excel xlsx file that I want to edit using python script. I know that openpyxl is not able to treat data-validation but I want just to edit the value of some cells containing data-validation and then save the workbook without editing those data-validation.

For now, when I try to do that, I get an error :

UserWarning: Data Validation extension is not supported and will be removed

and then my saved file doesn't contain anymore the data-validation.

Is there a way to tell openpyxl not to remove the data-validation when saving a workbook even if it can't read it?

1
  • It is probably not possible with openpyxl, but if you are on a Windows PC with Excel installed, you could write a Python win32com.client to interact directly with the file. Commented Aug 24, 2017 at 13:38

1 Answer 1

2

To be clear: openpyxl does support data validation as covered by the original OOXML specification. However, since then Microsoft has extended the options for data validation and it these that are not supported. You might be able to adjust the data validation so that it is supported.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the answer. The problem is that I can not adjust the data-validation on that file (it is a standard file I need to use like it is). So I think I will try win32com.client as suggested by Martin Evans.
Okay, it's worth nothing that there is also xlwings for remote controlling Excel. Might add support for the MS extensions at some point but it isn't currently a priority. I am surprised if validation is being completely stripped, though.
@CharlieClark, is there any process made on the above issue. It looks like the issue still exists where the data validation is completely being stripped off.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.