Free Blogger Templates :

facewoman
Ayo berikan dukungan dan semangan anda kepada kami hanya dengan like page Tutor | Blog™ agar tetap terus Maju.

Google Spreadsheet Script to get all the sheet names in Active Spreadsheet

Selasa, 09 Oktober 2012 | 0 komentar

Question:

Im trying to use the gallery script getAllSheetNames to put a list of sheets on a "report" sheet that I have. Im very new to javascript and while I understand how it is getting the names and creating a list, Im not sure how to have the data flow into my sheet. 

Im trying for instance to have it start at range A5 for the first item, A6 for the second etc...

Can somebody help me with an example how to populate cells from data in a list. 



Solution:

Here is the script to get all sheet names in the active spreadsheet, open script editor and paste the following script in it:


function getAllSheetNames() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var currentSheet = ss.getSheetByName("report");
  var sheets = ss.getSheets();
  var sheetnames = [];
  
  for(var i=0;i<sheets.length;i++)
    sheetnames.push([sheets[i].getName()]);

  //To set values from Cell A5
  currentSheet.getRange(5,1,sheetnames.length,1).setValues(sheetnames);
}



The above script will populate all the sheet names in Sheet 'report', which you can change according to your requirement.


And If you are not much familiar with scripts then check out the following link:


I hope the above solution will help you, and if you need more help then please do comment below on this blog itself, I will try to help you out.

I also take up private or confidential projects:

If this blog post was helpful to you, and if you think you want to help me too and make my this blog survive then please donate here: http://igoogledrive.blogspot.com/2012/09/donate.html 

Thanks,
Share to Your-Friends

0 komentar:

Posting Komentar

 
Support : Free Blog Templates | Free GPRS lt
Copyright © 2012. Tutor | Blog™ - All Rights Reserved
Proudly powered by Free Blog Template
Contact @ FREE GPRS LT