0
votes

Here is the sample sheet link

https://docs.google.com/spreadsheets/d/1ijCIzNmlV5V6Y3_PyHIeol7knK_h1FEcmaUPZZ0f5kA/edit?usp=sharing

Column A Contains the different spreadsheet address under my account. in column B i need the Spreadsheet Title of Each Address. Is there any Appscript or Function Available to automate it

1

1 Answers

1
votes

You can try this code below, this should be pretty self descriptive:

Code:

function getSpreadsheetNames() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var lastRow = sheet.getLastRow();
  var sheetIds = sheet.getRange("A2:A" + lastRow).getValues();
  sheetIds.forEach(function (sheetId, index){
    var title = SpreadsheetApp.openById(sheetId).getName();
    sheet.getRange(index + 2, 2).setValue(title);
  });
}

Output:

output

Note:

  • I did my sample on my spreadsheets since I don't have permission on your spreadsheets.
  • Running this on sheets you don't have access to will cause this error: error
  • In the case above, ask the owner of the sheets to give you access so that the script will run.