如何判断单元格值是否已通过验证 [英] How to tell if a cell value has passed validation

查看:61
本文介绍了如何判断单元格值是否已通过验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我熟悉Google Apps脚本 DataValidation 目的.获取并设置验证标准.但是如何以编程方式判断单元格值是否实际有效.因此,我可以在电子表格中看到红色验证失败的小消息,但是可以通过代码来获取当前未通过验证的单元格的事实吗?

I am familiar with the Google Apps script DataValidation object. To get and set validation criteria. But how to tell programatically if a cell value is actually valid. So I can see the little red validation fail message in the spreadsheet but can the fact the cell is currently failing validation be picked up thru code?

我试图查看是否有一个单元格属性可以告诉您这一点,但是没有.另外,我也在寻找某种DataValidation验证"方法-即根据验证规则测试值,但那里也没有

I have tried to see if there is a cell property that tells you this but there is not. Also I looked for some sort of DataValidation "validate" method - i.e. test a value against validation rules, but nothing there either

有什么想法吗?这可能吗?

Any ideas? Is this possible??

推荐答案

针对您问题的具体答案,Google Apps脚本中没有方法可以返回Range的有效性,例如.isValid().如您陈述的那样,您可以使用Range.getDataValidations()反向编程一个程序化程序,然后解析其结果,以再次验证Range.getValues()调用的值.

Specific answer to your question, there is no method within Google Apps Script that will return the validity of a Range such as .isValid(). As you state, you could reverse engineer a programatic one using Range.getDataValidations() and then parsing the results of that in order to validate again the values of a Range.getValues() call.

这是一个很好的建议.我已将功能请求添加到问题跟踪器->

It's a good suggestion. I've added a feature request to the issue tracker -> Add a Star to vote it up.

这篇关于如何判断单元格值是否已通过验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆