OfficeDev / OfficeDev/office-scripts-docs-reference

ExcelScript.ListDataValidation.source can't take a ExcelScript.Range

Open
#290 3 comments 0 reactions 1 assignee View on GitHub

@jeremy-msft is already working on this.

Since Sep 20, 2023.

Status: in backlog Type: product bug
Dominant language
TypeScript
Stars
71
Forks
36
Avg merge
4d 14h
Merged PRs (30d)
12

Description

When I run the following code snippet, it runs indefinitely without performing any action:

function main(workbook: ExcelScript.Workbook) {
    const rangeDataValidation = workbook.getActiveWorksheet().getRange("B2:B5").getDataValidation();
    rangeDataValidation.setRule({
        list: {
            inCellDropDown: true,
            source: workbook.getWorksheet("Data").getRange("A1:A3")
        }
    });
}

However, when I run the following code:

function main(workbook: ExcelScript.Workbook) {
    const rangeDataValidation = workbook.getActiveWorksheet().getRange("B2:B5").getDataValidation();
    rangeDataValidation.setRule({
        list: {
            inCellDropDown: true,
            source: "test1,test2,test3"
        }
    });
}

Everything works as expected. Am I doing something wrong with the cell range in the first code snippet?

(If this is not the appropriate place for this issue, please redirect me to the correct repository.)


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.