I have 1 googlesheets file with 2 sheets in it and both sheet has different forms.

I have a code that calls 2 functions format and prio:

function onFormSubmit(e) { 


QUESTION: how can I make this code not affect the other sheet?

I thought of the code below but it didn't work...

function onFormSubmit(e) { 

if(e.source.getActiveSheet().getName() === "Sheet1")
{Format(e) && Prio();}

---> btw, row > 1 is for the header

  • but it didn't work Would you please edit your question to be more specific. Was there an error message? Did you do any troubleshooting to identify where the script stopped. FWIW, I would prefer var sheet = e.range.getSheet().getSheetName();. Also I would use "Format(e)" as my trigger (and insert the logic in that function) and call "Prio" at the end of Format(e). In my limited experience, && (as in {Format(e) && Prio();} is a "logical" operator and has no place here. Just called Format(e);, then Prio;.. Lastly, you mention row > 1, but this doesn't appear in any of your scripts. – Tedinoz Jul 24 at 2:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.