Google Script Activate Sheet based on Reference Cell











up vote
0
down vote

favorite












I am trying to activate a sheet based on a reference cell. For example, based on a formula I have in cell J13, it will change between Sheet 2, Sheet 3, or Sheet 4. This would then tell the script which sheet to run a script to hide rows. The row hiding works well, I just need the reference to work. It seems something close to:



var ss = SpreadsheetApp.getActiveSheet().getSheetByName('Sheet 2');


But I want the 'Sheet 2' to be dynamic based on the value in cell J13.










share|improve this question
























  • So read the value of Range "J13" into where you have written 'Sheet 2'? Use the in-editor autocomplete and the handy-dandy Help ->Documentation menu to learn the language you are using.
    – tehhowch
    Nov 19 at 16:01












  • Thank you for your suggestion. I'm not very experienced with this and their documentation doesn't make much sense to me, hence me asking the question on a forum.
    – user10675503
    Nov 21 at 14:56










  • Look up the class Range. Also the class Sheet. From a Sheet, you can get a Range. From a Range, you can get a value.
    – tehhowch
    Nov 21 at 22:11















up vote
0
down vote

favorite












I am trying to activate a sheet based on a reference cell. For example, based on a formula I have in cell J13, it will change between Sheet 2, Sheet 3, or Sheet 4. This would then tell the script which sheet to run a script to hide rows. The row hiding works well, I just need the reference to work. It seems something close to:



var ss = SpreadsheetApp.getActiveSheet().getSheetByName('Sheet 2');


But I want the 'Sheet 2' to be dynamic based on the value in cell J13.










share|improve this question
























  • So read the value of Range "J13" into where you have written 'Sheet 2'? Use the in-editor autocomplete and the handy-dandy Help ->Documentation menu to learn the language you are using.
    – tehhowch
    Nov 19 at 16:01












  • Thank you for your suggestion. I'm not very experienced with this and their documentation doesn't make much sense to me, hence me asking the question on a forum.
    – user10675503
    Nov 21 at 14:56










  • Look up the class Range. Also the class Sheet. From a Sheet, you can get a Range. From a Range, you can get a value.
    – tehhowch
    Nov 21 at 22:11













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am trying to activate a sheet based on a reference cell. For example, based on a formula I have in cell J13, it will change between Sheet 2, Sheet 3, or Sheet 4. This would then tell the script which sheet to run a script to hide rows. The row hiding works well, I just need the reference to work. It seems something close to:



var ss = SpreadsheetApp.getActiveSheet().getSheetByName('Sheet 2');


But I want the 'Sheet 2' to be dynamic based on the value in cell J13.










share|improve this question















I am trying to activate a sheet based on a reference cell. For example, based on a formula I have in cell J13, it will change between Sheet 2, Sheet 3, or Sheet 4. This would then tell the script which sheet to run a script to hide rows. The row hiding works well, I just need the reference to work. It seems something close to:



var ss = SpreadsheetApp.getActiveSheet().getSheetByName('Sheet 2');


But I want the 'Sheet 2' to be dynamic based on the value in cell J13.







google-apps-script






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 at 14:53

























asked Nov 19 at 15:29









user10675503

42




42












  • So read the value of Range "J13" into where you have written 'Sheet 2'? Use the in-editor autocomplete and the handy-dandy Help ->Documentation menu to learn the language you are using.
    – tehhowch
    Nov 19 at 16:01












  • Thank you for your suggestion. I'm not very experienced with this and their documentation doesn't make much sense to me, hence me asking the question on a forum.
    – user10675503
    Nov 21 at 14:56










  • Look up the class Range. Also the class Sheet. From a Sheet, you can get a Range. From a Range, you can get a value.
    – tehhowch
    Nov 21 at 22:11


















  • So read the value of Range "J13" into where you have written 'Sheet 2'? Use the in-editor autocomplete and the handy-dandy Help ->Documentation menu to learn the language you are using.
    – tehhowch
    Nov 19 at 16:01












  • Thank you for your suggestion. I'm not very experienced with this and their documentation doesn't make much sense to me, hence me asking the question on a forum.
    – user10675503
    Nov 21 at 14:56










  • Look up the class Range. Also the class Sheet. From a Sheet, you can get a Range. From a Range, you can get a value.
    – tehhowch
    Nov 21 at 22:11
















So read the value of Range "J13" into where you have written 'Sheet 2'? Use the in-editor autocomplete and the handy-dandy Help ->Documentation menu to learn the language you are using.
– tehhowch
Nov 19 at 16:01






So read the value of Range "J13" into where you have written 'Sheet 2'? Use the in-editor autocomplete and the handy-dandy Help ->Documentation menu to learn the language you are using.
– tehhowch
Nov 19 at 16:01














Thank you for your suggestion. I'm not very experienced with this and their documentation doesn't make much sense to me, hence me asking the question on a forum.
– user10675503
Nov 21 at 14:56




Thank you for your suggestion. I'm not very experienced with this and their documentation doesn't make much sense to me, hence me asking the question on a forum.
– user10675503
Nov 21 at 14:56












Look up the class Range. Also the class Sheet. From a Sheet, you can get a Range. From a Range, you can get a value.
– tehhowch
Nov 21 at 22:11




Look up the class Range. Also the class Sheet. From a Sheet, you can get a Range. From a Range, you can get a value.
– tehhowch
Nov 21 at 22:11

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377859%2fgoogle-script-activate-sheet-based-on-reference-cell%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377859%2fgoogle-script-activate-sheet-based-on-reference-cell%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Costa Masnaga

Fotorealismo

Sidney Franklin