How to Download Multiple Files with 1 Button?

Hello, I have a table containing links to download Google Spreadsheets as excel files (browser will try to download excel files just from opening these links). Currently, I have a button on each row to download a file of that row. This works, but I want to implement batch download with checkboxes and 1 button.

I have added a checkbox on each row, and I want to assign a button to run the following script to download files for all rows with checkbox selected.

const indices = Object.keys(table.changeSet);

for (const i of indices) {
  const url = table.data[i].spreadsheetUrl;
  utils.openUrl(url);  
}

However, this script seems to end as soon as utils.openUrl executes once, so I could not download more than 1 file.

Please advise. Thank you.

Hey @ashih, welcome to the community :mechanical_arm:

Should work if you enable Popups and redirects in your browser.

Screenshot 2022-01-18 at 19.22.14