Hey @amsrivas ,
You need to create/edit/record the script from inside Excel Online when a workbook is opened, but the script itself won't be saved into that workbook. Instead, it will be saved to your own OneDrive for Business.
So if the Office Scripts feature is turned on in your organization/tenant (hopefully), you should be able to see the "Automate" tab. You can click on "Code Editor" to open up the script Code Editor pane.

Then type in the script into the Code Editor pane. Save it with a meaningful name.

After that, from the Run script action in Power Automate, you should be able to pick that script from the Script dropdown list.
But if you're not seeing the "Automate" tab in Excel Online, that means your admin hasn't turned on Office Scripts for your organization yet. In that case, I guess you'll probably need to do some data wrangling with the other existing Excel Online (Business) actions like "List rows present in a table", "Update a row", "Add a row into a table", etc.
Yutao