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 the Parent Folder

Selasa, 09 Oktober 2012 | 0 komentar

Question:

I need to write a custom Spreadsheet function (apps script) that shows the name of the folder it is in. 
I tried getParents but that is not available to SpreadsheetApp.getActiveSheet().


Solution:

Following is the script that give you the name of parent folder of the active spreadsheet:


function getParentFolder() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var ssId = ss.getId();
  
  var file = DocsList.getFileById(ssId);
  var fileId = file.getId();
  
  var ParentFolders = file.getParents();
  
  Browser.msgBox(ParentFolders[0].getName());
}

Note: To run this code you will have to authorize the script, and after authorization you will be able to use the above function.


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