excel - PHP Spreadsheet date validationGet the solution ↓↓↓
So Im wondering how could I create a validation for date while generating excel?
I read on data validation also some articles only suggest
setFormatCode which is not I guess validating the,
the data validation which has a whole number example works,
Then upon reading on API there is a
DATE_TYPE which is I tried to use but still not generating a date type validation upon creating excel
$validation=$sheet->getCell('A3')->getDataValidation(); $validation->setType( \PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_DATE ); $validation->setErrorStyle( \PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_STOP ); $validation->setAllowBlank(true); $validation->setOperator('isValidDate'); $validation->setErrorTitle('Oops!'); $validation->setError('Invalid date.');
My question is, does spreadsheet support date validation? and if not why is there a date type and not having a valid date operator?
I guess it does support date validation but, its not that kind of effective, when viewed by Google Sheets or Microsoft Excel it gets override, then the date format will be converted in to text and the validation will not work any longer.
Share solution ↓
Link To Answer People are also looking for solutions of the problem: closed without sending a request; it was probably just an unused speculative preconnection
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.