0

I am not a coder, but I can normally do enough trial and error to get my script to function in the way I want my google sheet to work.

The goal of my script:
I want cell A to time stamp anytime that cell B is edited. It is doing exactly what I want on my first tab. I need it to run only on the first 5 tabs etc, but then exclude the following tabs that I want running my Queries for other information from the first tabs.

-I have gotten the code to run on all tabs. I have tried editing the SHEETNAME = to include the sheets I want the script ran on. I have changed a ton of it, but I decided to just paste the script that runs how I desired on the singular tab.

-I may need to tear the script apart and restart, but it is tough when it is achieving the perfect result on the first tab labeled 'Client'.

Current script that is only working on a singular tab

1 /**
 
2 * Creates a Date Stamp if a column is edited.

3 */

4  

5 //CORE VARIABLES

6 // The column you want to check if something is entered.

7 var COLUMNTOCHECK = 2;

8 // Where you want the date time stamp offset from the input location. [row, column]

9 var DATETIMELOCATION = [0,-1];

10 // Sheet you are working on

11 var SHEETNAME = 'Client'

12  

13 function onEdit(e) {
  
14 var ss = SpreadsheetApp.getActiveSpreadsheet();
  
15 var sheet = ss.getActiveSheet();
 
16 //checks that we're on the correct sheet.
  
17 if( sheet.getSheetName() == SHEETNAME ) {
   
18 var selectedCell = ss.getActiveCell();
   
19  //checks the column to ensure it is on the one we want to cause the date to appear.

20    if( selectedCell.getColumn() == COLUMNTOCHECK) {

21      var dateTimeCell = selectedCell.offset(DATETIMELOCATION[0],DATETIMELOCATION[1]);

22      dateTimeCell.setValue(new Date());

23      }

24  }

25 }

Link to the test document https://docs.google.com/spreadsheets/d/1hOobE5vDzMu6jjuXQcTRMRMIMv6TWDWHeipDnyrmzSM/edit?usp=sharing

3

0