I am trying to create a "check in - check out" form to register the time in and out of workers at a company, using Excel for Web (ExcelScript). For every worker in the form, there has to be in the adjacent rows a Check IN and a Check OUT button that will stamp in the cell underneath the button the current time, and delete the button, as it was usually done with VBA macros.
worksheet.onSingleClicked() so the user would click on a cell that looks like a button, and it will call a function to stamp the current time and remove all button formatting.
onChanged(), but I cannot find anything similar on the ExcelScript docs, which I understand is the only API that can run on Excel for Web.
Is there any way to create user interactable buttons in a
for loop, or to register events (like
onChanged()) to be used in Excel for Web?
You need to add manually. New Office scripts are quite limited nowadays. But you may post a feature request for the team.
Feature requests on Tech Community are considered, when the dev team go through the planning process. Use the github label: “Type: product feature request” at https://aka.ms/M365dev-suggestions .
Using JADE, you could either format the cells to look like buttons on the sheet or have the code render a list of employees with actuall check-in / check-out buttons in the addin panel.
I'd be glad to write and example of either approach, but it probably should be in response to a questions specifically about how to do this with the JADE add-in. If you want such an example, post another question and link to in a comment to this answer and I'll write the example(s).
Discalimer: I wrote the JADE add-in.