Can I use Data Validation in a table in Loop? (like in Quip)

Ruiz, Patricia 0 Reputation points
2025-12-18T14:54:33.0533333+00:00

I want to add data validation into a cell in a table in loop. Like Status: Green, Yellow, Red. The I want to do math based on the data validation.


Moved from: Microsoft 365 Insider | Loop | Windows

Microsoft 365 and Office | Loop | Other
Microsoft 365 and Office | Loop | Other
A collaborative workspace app in Microsoft 365 designed to help teams co-create, stay organized, and work together in real time across apps and devices.
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Q&A Assist
    2025-12-18T14:55:23.9333333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    You can implement data validation in Excel tables programmatically using the Excel JavaScript API. To add data validation for a specific cell or range within a table, you can utilize the dataValidation property. For instance, if you want to create a dropdown list with options like "Green", "Yellow", and "Red", you can define these values in the source property of the dataValidation object.

    Here’s a simplified example of how to apply data validation in a loop:

    await Excel.run(async (context) => {
        let sheet = context.workbook.worksheets.getActiveWorksheet();
        let table = sheet.tables.getItem("YourTableName");
        let range = table.getDataBodyRange();
    
        // Loop through each cell in the range to apply data validation
        range.values.forEach(async (row, rowIndex) => {
            row.forEach(async (cell, colIndex) => {
                let cellRange = range.getCell(rowIndex, colIndex);
                cellRange.dataValidation = {
                    rule: {
                        list: {
                            source: "Green, Yellow, Red"
                        }
                    },
                    inCellDropDown: true
                };
            });
        });
    
        await context.sync();
    });
    

    In this code snippet, data validation is applied to each cell in the specified range of the table, allowing users to select from the defined statuses. You can then perform calculations based on the selected values in these cells as necessary.


  2. Ruiz, Patricia 0 Reputation points
    2025-12-18T14:55:53.2366667+00:00

    I mean in Loop NOT in Excel.

    0 comments No comments

  3. EmilyS726 188.2K Reputation points Independent Advisor
    2025-12-18T20:16:35.11+00:00

    Hello, no, Loop does not currently support true data validation or formulas in tables the way Excel or Quip does. Sorry.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.