Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dataValidations not detected in Office 365 files #46

Closed
davidski opened this issue Dec 6, 2018 · 8 comments
Closed

dataValidations not detected in Office 365 files #46

davidski opened this issue Dec 6, 2018 · 8 comments

Comments

@davidski
Copy link

davidski commented Dec 6, 2018

xlsx_validation() doesn't seem to pick up data validation rules when the list of allowed values is on a different sheet. This (test_validation.xlsx) test file generates zero detected data validation rules, even though one is present.

Tested syntax

tidyxl::xlsx_validation(here::here("data/test_validation.xlsx"))

and

tidyxl::xlsx_validation(here::here("data/test_validation.xlsx"), sheets = c(1, 2))
@nacnudus
Copy link
Owner

nacnudus commented Dec 6, 2018

Thanks for the report and the reproducible example. I can confirm tidyxl doesn't detect the rule. Strangely Excel 2016 for PC doesn't either, but LibreOffice Calc does.

The XML of the rule is unusual. What software was used to create the file?

@davidski
Copy link
Author

davidski commented Dec 6, 2018

The test file was generated with Excel for Mac (Office 365 - V16.16.4). I have an internal file using a similar style of validation rule created with Excel for Windows (Office 365) that generates the same problem. 😦

Thanks for the quick response and the handy package!

@nacnudus
Copy link
Owner

nacnudus commented Dec 6, 2018

Ah, thanks for checking both Mac and Windows. Can I ask you one more favour, please could you send a file with a formula in one cell? The bug is to do with the way the formula (the range of the list) is expressed in XML, so I'd like to check whether it affects normal formulas in cells.

@davidski
Copy link
Author

davidski commented Dec 6, 2018

Sure thing! Here's a basic one.

test_validation_w_formula.xlsx

@nacnudus
Copy link
Owner

nacnudus commented Dec 9, 2018

Similar bug to PHPOffice/PhpSpreadsheet#388. Need to handle x14 and xm extensions to the spec.

nacnudus added a commit that referenced this issue Dec 9, 2018
Office 365 data validation compatibility (#46)
@nacnudus nacnudus changed the title xlsx_validation() using ranges on different sheets dataValidations not detected in Office 365 files Dec 9, 2018
@nacnudus
Copy link
Owner

nacnudus commented Dec 9, 2018

@davidski Please try devtools::install_github(nacnudus/tidyxl), and reopen this issue if it doesn't work. Thanks for the helpful report and files.

I'm curious what you use the xlsx_validation() for in case I could support the workflow better somehow. It's a pretty niche function.

@davidski
Copy link
Author

Thanks! An install off of master seems to be working!

The use case on this is a bit odd - I have some Excel workbooks that are used for structured data entry (uploading) into a commercial closed source tool. The workbooks have some validation applied to ensure the data is put into the correct format, but the rules themselves are not well documented. I am looking to use tidyxl to pull out the validation rules and reverse engineer them, allowing these uploads to be created with other tools (like Shiny, for instance).

Appreciate the fix on this!

@nacnudus
Copy link
Owner

That sounds niche enough! Thanks for the explanation, I hope it works out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants