Git Product home page Git Product logo

gdrive-get-file-list's Introduction

Google Apps: Get list of parent/child/sibling files and folders from a Google Drive Folder

A Google Apps Script for Google Sheets to list folders and files from a Google Drive folder

What this is for:

I had a project where I needed to migrate a shared folder to a shared drive instead. I opted to make a GSheet to do all the file listings and then had the sheet generate all items in folder rather than manual entry.

(I'll try to make this into a template for quick use but for now here is a simple how to)

How to use

  1. Open a new Google Sheet
  2. Go to Extensions > App Scripts, this will open a new tab with an empty "Untitled Project". Feel free to click that area and name your project.
  3. Remove the small code they place in the project by default and copy the contents of code.js from this repo and paste into the new project. Hit save.
  4. Go back to your GSheet and reload the page
  5. You should now see a List Files/Folders menu item pop-in (takes a few seconds)
  6. Click the List File/Folders > List All Parent/Child Files and Folders menu item
  7. Google is going to prompt you for authorization at this part, go ahead and click Authorize
  8. You'll then choose your Google Account from the list
  9. You'll get a warning like so, in transparency this is my first go with app scripts so not sure how to verify, if you know please feel free to submit a pull request on this and we can update these directions. Click Advanced > Go to [Your Projects Name] (unsafe). Note, you will probably see your email in the blurred part of the image below.

Warning showing need to verify the app

  1. You'll now see a prompt for allowing the script to access your Google Drive, Allow it
  2. Now repeat step 6 (Click the List File/Folders > List All Parent/Child Files and Folders menu item)
  3. Go to another tab and navigate to a folder in your GDrive and click into that folder, in the navbar you will see the ID for you folder: ex: https://drive.google.com/drive/u/1/folders/[folderIDHere]
  4. Copy the folder Id and then paste into the prompt's input from you Google Sheet
  5. Give the script a minute or two to run and you should see your things appear, you should see something like so:

Showing what happens after the script run

Fields List

  • Full Path: the full path to the files location
  • Name: Name of the file
  • Type: Type of file - [https://developers.google.com/drive/api/guides/mime-types](see full list here)
  • Date: Date created
  • Last updated: Date the file was last updated
  • Description: Pulled from the file description you can assign in Google Drive
  • Owner Email: Email of the person who owns the file
  • Owner Name: Nae of the person who owns the file
  • Owner Avatar: Picture of the person who owns the file

Thats about it! Now if you are like me, you have the option of also running the Set Folders Formatting to Bold menu item from the List Files/Folders menu and you should see any line item that is a folder become bold and have a light grey (#f3f3f3) background.

Other things in this file:

  • Duplicate Active Tabs - Choose an active tab, choose this menu item, enter a number and viola, duplicates of the tab to whatever number you set
  • Formula =sheetnames() creates a list of all the tabs on the workbook.

gdrive-get-file-list's People

Contributors

ajlaporte avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.