Google apps spreadsheet parents folder ID -
i have google spreadsheet keeping track of files , names inside folder spreadsheet is.
have looked , can not find how location or id of sheet
in ms cmd script "%~dp0".
how in google apps spreadsheet script.
function fnctnmenuupdategetlocation() { var ss = spreadsheetapp.getactivespreadsheet(); var ssid=ss.get.getid(); var file = docslist.getfilebyid(ssid); browser.msgbox(ssid); browser.msgbox(add); }
https://docs.google.com/spreadsheet/ccc?key=0amsqn3n9km70dgwtltjxvvbzbmjhdme5ofpkbtvxele&usp=sharing ya, working in it
live sheet
from have how address of spreadsheet in google drive
spread sheet having add folder/dir , file need
since google docs not google drive how interface spreadsheet google drive
both document service , drive service can report folder(s) spreadsheet in.
here's function, updated show name of folder contains spreadsheet, using both services.
function fnctnmenuupdategetlocation() { var ss = spreadsheetapp.getactivespreadsheet(); var ssid=ss.getid(); var fileindocs = docslist.getfilebyid(ssid); var folderindocs = fileindocs.getparents()[0].getname(); var fileindrive = driveapp.getfolderbyid(ssid); var folderindrive = fileindrive.getparents().next().getname(); browser.msgbox("docs says: " + folderindocs + ", drive says: " + folderindrive); }
document service's .getparents()
method returns array of folder objects, while drive's returns iterator, details of how retrieve specific parent folder(s) once you've got of them differs.
note spreadsheet may "contained" in multiple folders... in case, we've assumed first folder in list 1 - assumption may invalid.
Comments
Post a Comment