I have a row with multiple urls on it. I'd like to open each url in a separate browser tab without having to click on each link. Is this possible in Google Sheets or Google Apps Script?

  • @Rubén, I googled. I found nothing to try. – toddmo Dec 19 '19 at 1:12
  • 1
    @Rubén, please see my answer below. It's possible via Google Apps Script HtmlService (indirectly). What you said in your answer here stackoverflow.com/a/29906951/1045881 is technically correct when you said Script itself will not automatically open web pages, but the end effect is possible via the combination of server and client script. – toddmo Jan 6 '20 at 16:36

Here's how to open multiple urls in different new browser tabs:

multiple urls in different browser tabs

It creates html script to do the job. Be sure the urls each begin with the protocol (e.g., not just 'www') or google will get confused.

The function takes an array of urls. Those can come from anywhere including getValues() where you've got multiple urls on a row in a spreadsheet, or anywhere else.

function openTabs(urls) {
    urls = [urls];

  var html = 
    "<script>" + 
      urls.map(function(url) {
        return "window.open('" + url + "');";
      .join('') +
      "google.script.host.close();" + 

  var userInterface = HtmlService.createHtmlOutput(html)
  .setWidth( 90 )
  .setHeight( 1 );

  SpreadsheetApp.getUi().showModalDialog(userInterface, 'Opening...');

function testOpenTabs() {
  var urls = ['http://www.google.com','http://www.stackoverflow.com','http://www.wikipedia.com'];
  • 1
    I tested your code. It works! P.S. Don't forget to mark this answer as accepted. – Rubén Jan 11 '20 at 23:09
  • @Rubén, gosh thanks Ruben! That's very nice of you :) – toddmo Jan 12 '20 at 15:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.