From d38e63ccd53020749f7bfa2a928b5f26f896e9ff Mon Sep 17 00:00:00 2001 From: TeeMonk Date: Sat, 7 Jul 2018 03:07:18 +0200 Subject: [PATCH 1/2] Update Lib.gs --- Lib.gs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib.gs b/Lib.gs index 91d3623..f093af3 100644 --- a/Lib.gs +++ b/Lib.gs @@ -24,10 +24,10 @@ function GetSheets(spreadsheet) function GetActiveSheet(sheetname) { var sheet; - if (sheetname == '') { - sheet = SpreadsheetApp.getActive().getActiveSheet(); - } else { + if (sheetname) { sheet = SpreadsheetApp.getActive().getSheetByName(sheetname); + } else { + sheet = SpreadsheetApp.getActive().getActiveSheet(); } return sheet; } From 2af415984c839e905ec87fa63ba1f4c44b451856 Mon Sep 17 00:00:00 2001 From: TeeMonk Date: Sat, 7 Jul 2018 03:09:47 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9547f83..e82370e 100644 --- a/README.md +++ b/README.md @@ -61,9 +61,9 @@ function GetSheets(spreadsheet) ## Get Active Sheet -`GetActiveSheet` function used to get the active OR specific sheet of spreadsheet. it takes `sheetname` as input argument. in case if `sheetname` passed as blank string, it returns active sheet, otherwise it return the sheet provided as `sheetname` +`GetActiveSheet` function used to get the active OR specific sheet of spreadsheet. it takes `sheetname` as input argument. in case if `sheetname` argument is not provided, it returns active sheet, otherwise it return the sheet provided as `sheetname` -We had need of get instance of Current Sheet and in some cases Specific Sheet. so we created a parameterized function that served purpose. To get the Current Active Sheet we can simply use this function with empty sting ('') and in case to get Specific Sheet we can simply use sheet name. +We had need of get instance of Current Sheet and in some cases Specific Sheet. so we created a parameterized function that served purpose. To get the Current Active Sheet we can simply use this function with no argument () and in case to get Specific Sheet we can simply use sheet name. ```javascript /** @@ -73,10 +73,10 @@ We had need of get instance of Current Sheet and in some cases Specific Sheet. s function GetActiveSheet(sheetname) { var sheet; - if (sheetname == '') { - sheet = SpreadsheetApp.getActive().getActiveSheet(); - } else { + if (sheetname) { sheet = SpreadsheetApp.getActive().getSheetByName(sheetname); + } else { + sheet = SpreadsheetApp.getActive().getActiveSheet(); } return sheet; }