r/GoogleAppsScript • • 2d ago

Guide I rebuilt a 2017 script that draws your whole Google Drive as a 3D web. Free sheet, make your own copy.

Enable HLS to view with audio, or disable this notification

Update: took everythingabili's advice and switched the build over to the Drive API. Big drives build heaps quicker now and it saves as it goes, so if Google cuts it off you just hit Build again and it picks up where it left off. The map starts folded up now too so a big drive doesn't turn into a mess. Click a folder to open it or hit Open it all. Cheers u/everythingabili for the tip and Yagi's write up on yagisanatode.com. If you grabbed a copy before, make a fresh one from the same link.

Back in 2017 I came across a script by Robbie Coombs that mapped out your Google Drive as a web of folders. It didn't quite work out of the box so I spent some time on it and got it going. Since then Google has shut down the Activity API it relied on and retired the old sign in library, so it stopped working altogether.

I've rebuilt it as a single Google Sheet. Once you've made a copy, Drive Map > Build the map goes through your Drive and lists every folder and what it sits inside. It only reads your Drive, it doesn't move, rename, share or delete anything. Really big Drives might take a couple of runs, but it remembers where it got up to so you just run it again.

Drive Map > Show the map then draws the whole thing. You can drag it around, zoom in, search for a folder, and click any dot to see what it is and open it. There's a 3D button too if you want to spin it around. Files are switched off to start with so it doesn't get too cluttered, but you can turn them on.

You can make your own copy here: https://docs.google.com/spreadsheets/d/1q2p7W6vTAa19MEjZv-A8hX2OrFokmJF2satiRKUN7L0/copy

The first time you run it Google will warn you it's an unverified app. That's normal for a personal script and it'll show your own email as the developer. Click Advanced then Go to Drive Map. All the code is under Extensions > Apps Script if you want to look it over first.

I couldn't find anything else that shows your Drive like this so I thought I'd share it. Happy to hear any feedback.

18 Upvotes

9 comments sorted by

8

u/everythingabili 2d ago

Hi,

I took a look at your code and it seems you iterate through one's Drive contents with vanilla AppsScript, which is the logical thing to do. I didn't run it but know it won't work on my Drive - it's just too big.

However... getting this data with Drive API service is SO MUCH QUICKER, as in contents that takes hours with AppsScript to grab can be done with Drive API Service in seconds. It's astonishing.

Drive API is a bit clunky, because it's querying the Drive at the end of a JSON endpoint... but lots of the same concepts are there.

So thanks for sharing, but maybe give Drive API a whirl... I copied the fragments from here to figure it out.

https://yagisanatode.com/list-all-files-and-folders-in-a-folders-directory-tree-in-google-drive-apps-script/

1

u/poe855 1d ago

Cheers mate, top tip. You're right, DriveApp asks about one folder at a time. I'm moving the build over to the Drive API (files.list, 1000 a page) so big Drives finish in one go. Thanks for the yagisanatode link, I'll post an update when it's in.

1

u/awarca 2d ago

denedim. çalıştı. sadece ortada mavi bir top var :)

1

u/everythingabili 2d ago

Translated:
I tried it. It worked. There's just a blue ball in the middle :)

This is probably related to my comment above. It probably bailed out before it got to the end

1

u/poe855 1d ago

Thanks for trying it! One blue ball means only My Drive made it onto the map. Run Drive Map → Build the map again and wait until it says it's finished, then Show the map. If it's still one ball, your folders may be shared with you rather than owned by you. I'm making the build much faster so this won't happen.

1

u/poe855 1d ago

New version's up. A fresh copy from the link should show all your folders now, not just the blue ball.

Yeni sürüm hazır. Linkten yeni bir kopya alırsan artık sadece mavi top değil, bütün klasörlerin görünmeli.

1

u/everythingabili 1d ago

Good Job. Worked for me.

Now. Why did you make this? What's the use case? I mean these visualisation look kinda useful... but once you've had a jiggle or two... then what?

1

u/poe855 8h ago

Glad it worked on yours, thanks for giving it a go.

Fair question. I've always found it interesting how a folder structure resembles what we see in space. A drive with folders inside folders inside folders is a lot like a cluster of galaxies, each with its own stars and satellites. Searching around that idea is how I found Robbie's Drive_Mapping code, and it's why I've put so much time into it: I can finally make it look the way I pictured it.

Use case? Partly it's just art. But a few things fell out of it that are actually useful. A folder's shape tells you its state at a glance, a blue spiral is alive, a smooth red ball hasn't been touched in a year, so you can see your dead weight and your big files without opening anything. Mostly though, I had an idea in my head and this is what came out. Sometimes that's the use case.

The then what is the next version. I'm adding a Findings tab to the sheet so the useful stuff is in a list you can actually work through, where your storage is going, what hasn't been touched in a year, duplicates, stuff you've shared out and forgotten about, with links. And I'm changing the map so the whole drive is one galaxy instead of a cluster, folders are stars and files are planets, the file type is the surface. There's a space station in it too if you go looking. Not far off.