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

I am using Google App Scripts SpreadSheet.openById(), but it assumes Sheet0 as active sheet?

$
0
0

I am trying to create a trigger to get id when there is a change in sheet selection which is working fine when each google sheet has its own google app script, but I want to create a google app script which will work for every sheet based on spreadsheet-id.

So I tried running a function that has SpreadSheet.openById("SpreadSheet_id) from the Google Apps Script Editor, but it assumes the active sheet to be Sheet0 by default, even though the sheet that is open in my Google Sheets is Sheet1, and therefore returns incorrect things.

Is there any some other method, or solution to above problem I am facing?

This is the code I am using.

function getActiveSheetByURL(id) {  var ss = SpreadsheetApp.openById(id).getActiveSheet();  console.log(ss.getSheetId());}

Viewing all articles
Browse latest Browse all 9782

Trending Articles



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