Skip to content

How can I read dropdown from excel and get all options list? #2963

Answered by mrmarcin12
mrmarcin12 asked this question in Q&A
Discussion options

You must be logged in to vote

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)

    $range = $spreadsheet->getNamedFormula('Disc');

    $spreadsheet->getActiveSheet()->setCellValue('C100', '=' . $range->getFormula());
    var_dump(Calculation::getInstance($spreadsheet)->calculateCellValue($spreadsheet->getActiveSheet()->getCell('C100')));

Replies: 10 comments 13 replies

Comment options

You must be logged in to vote
1 reply
@mrmarcin12
Comment options

Comment options

You must be logged in to vote
1 reply
@mrmarcin12
Comment options

Comment options

You must be logged in to vote
1 reply
@mrmarcin12
Comment options

Comment options

You must be logged in to vote
1 reply
@mrmarcin12
Comment options

Comment options

You must be logged in to vote
6 replies
@mrmarcin12
Comment options

@MarkBaker
Comment options

@mrmarcin12
Comment options

@MarkBaker
Comment options

@mrmarcin12
Comment options

Comment options

You must be logged in to vote
1 reply
@mrmarcin12
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by mrmarcin12
Comment options

You must be logged in to vote
1 reply
@MarkBaker
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@josseve
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants