W
W
WebAnalytics12018-04-05 14:12:34
Google Apps Script
WebAnalytics1, 2018-04-05 14:12:34

How to get the folder names (path) that store the file?

Hello,
You need to write down the path to the file in column 9 (which we get by id from column 3) and this is all in the form of a cycle.
While we managed to glue it, from the found scripts, this is:

var ss = SpreadsheetApp.openById('ID').getSheetByName('Accesses');
  var lastRow = ss.getLastRow()
     for(var i = 2; i<=lastRow;i++){
     if(ss.getRange(i, 3).getValue()){
       ss.getRange(i, 9).setValue(DriveApp.getFileById(ss.getRange(i, 3).getValue()).getParents().next().getName().join("/"))}}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2018-04-05
@oshliaer

Absolutely useless occupation that requires a lot of resources. Plus, Disk can have folders within folders of their own folders. How do you like this turn?
The solution is available in this topic How do I locate the path of the folder in which th...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question