How can I read dropdown from excel and get all options list? #2963
-
Hello, I want to read dropdown options list from excel that is generated using formula in Excel. Can I do it using this libary? |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 13 replies
-
If it's a dataValidation list, then take a look the dataValidation methods |
Beta Was this translation helpful? Give feedback.
-
If the type is Note that documentation for this library is available online: for general information about how the library works, with lots of recipes and examples, and also the API documentation for all the classes. |
Beta Was this translation helpful? Give feedback.
-
If it's a named list, then you need to read the Named Ranges object for the spreadsheet to get the range: the Spreadsheet object's |
Beta Was this translation helpful? Give feedback.
-
So what are the options? Or even better, can you provide an example file so that I can see for myself? |
Beta Was this translation helpful? Give feedback.
-
In that case, then the evaluation of that formula should give you the list |
Beta Was this translation helpful? Give feedback.
-
I wrote a code that retrieves the Dropdown from another column. Maybe you will be interested. https://github.com/akbarali1/excel-upload-filter/blob/main/app/Http/Controllers/ExcelAutoFilterController.php helloWorld.xlsx |
Beta Was this translation helpful? Give feedback.
-
I did it! I extracted formula from this cell to $range and then I used this formula to random cell. Then I used method setCellValue with this formula, then I read it using calculateCellValue to get array! @MarkBaker thank you for support, I even didn't need to set Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_VALUE)
|
Beta Was this translation helpful? Give feedback.
-
hi, i have the same problem but when i try to getNamedFormula i get NULL
here my output: thank you |
Beta Was this translation helpful? Give feedback.
-
Thank you!!!! everythings works fine!!!!! |
Beta Was this translation helpful? Give feedback.
-
Hi for me doesnt work.... $reader2 = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); $Formula1 = $worksheet2->getCell("E2")->getDataValidation()->getFormula1(); $worksheet2->setCellValue('J25000', '=' . $Formula1); So i try function to recover other values of combobox... I try "=JOINDRE(' . $range.';"|")" same error When i put this in excel.. this work... Thanks |
Beta Was this translation helpful? Give feedback.
I did it!
I extracted formula from this cell to $range and then I used this formula to random cell. Then I used method setCellValue with this formula, then I read it using calculateCellValue to get array!
@MarkBaker thank you for support, I even didn't need to set Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_VALUE)