Forum Discussion
MattG
Dec 08, 2021Copper Contributor
Get user input to use in an Excel Online Script
Hi Does anyone know if it's possible to get user input to use as a variable with Excel Online Scripts? I have hundreds of people using a workbook online and need to use their username to filt...
JKPieterse
Dec 08, 2021Silver Contributor
Perhaps you can write a do-while type of loop which waits for an entry in that cell. Place the username cell on a separate tab and have the script activate that tab and clear the cell. Then start the waiting loop using code as mentioned here (not sure if that'll work in Office Script though): https://stackoverflow.com/questions/5551378/javascript-pausing-execution-of-function-to-wait-for-user-input
- JKPieterseDec 08, 2021Silver ContributorAlternatively, have the script clear the username cell at the end.
Place a button next to that cell that triggers the script. The script checks if the cell contains something and if so, assumes the entry is the username. If the cell is empty, the script selects the cell, perhaps writes a prompt in the cell above it and ends.