What I am trying to do is to open several browser tabs, the url will be coming from the cells of a spreadsheet.
I found a good tutorial for that. Apps Script: Open a new tab with an image - YouTube
I reproduced his code and now I am trying to make a loop, but the loop take only the last element of the list.
The problem must be simple, it must be the way I write my loop but I cant find it.
here is the code.
function openTab2() {
var selection = SpreadsheetApp.getActiveSheet();
var data = selection.getDataRange().getValues();
for (var i = 0; i < data.length; i++) {
var html= "<script> window.open( '" +(data[i][0]) + "');google.script.host.close(); </script>";
var userInterface = HtmlService.createHtmlOutput (html);
SpreadsheetApp.getUi().showModalDialog(userInterface, 'open Tab')
}