Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9786

Need to run a script on all google tabs, but I can only get it to work on the active tab

$
0
0

Alright. Ive spent four hours on this and Im about tapped out. I have this script here

function onEdit() {          var sheet = SpreadsheetApp.getActiveSheet();          var oldName = sheet.getName();          var newName = sheet.getRange(1,1).getValue();          if (newName.toString().length>0 && newName !== oldName) {           sheet.setName(newName);     }}

It Changes my active tabs name to whatever is in cell A1 of that sheet, but only if that tab is currently selected and if any changes are made to the sheet while activated.

Basically I have a set of reports, On the first tab I input names, and every tab updates to show the Inputted name in Cell A1. The person Im building the sheet for also wants the Tab names to be the information in cell a1 of that tab.

So The problem is this. I need all tab names to reflect their a1 cell and i need it to happen even if the tab is not the active tab. Is there any way to do this? I tried an Allsheets function but google sheets doesnt seem to have that. Please for the love of all things holy save my sanity

Sorry if theres an obvious solution. I know next to nothing about scripting. thank you for any help in advance


Viewing all articles
Browse latest Browse all 9786

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>