Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

217
Views
Is there a way to get the "parent" Spreadsheet which triggered the code?

I have a script that executes a code, i've attached it to some buttons in differents sheets and inside this code i need to get the sheet name that contains the buttom that triggered the script. Is there a way to get it?

I've coded this so far:


  let sht = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Escopo - Financeiro");

  var nomeDoc = sht.getRange("A2").getValue();
  var modulo = sht.getRange("B1").getValue();

So i need to change the .getSheetByName("Escopo - Financeiro") code to fit my needs.

I was wondering if i could use some certain of "this" or "parent" statement, but i havent found it.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

So since i've bounded my script to a button which is into an active spreadsheet, replacing the SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Escopo - Financeiro"); part of the code to SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); solved the problem.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!