Search code examples
google-apps-scriptgoogle-sheetscopyrename

Copy Name from one sheet to another


I have two separate sheets, let's call them Data and Duplicate. They both have their own set of tabs. Each tab has its own set of data. I want the name of the sheet "Data" to rename the first tab in Duplicate sheet tab1.

How can this be done using app script?


Solution

  • Put this in spreadsheet Data

    function renamefirst() {
      const ss = SpreadsheetApp.openById("id of spreadsheet Duplicate");
      const sh = ss.getSheets()[0];
      sh.setName("Tab1")
    }