Create Files Cabinet from Google Drive folder
Turn a Google Drive Folder into a beautiful files cabinet
In your Google Site or in your Corporate website, it is convenient to share files stored in a Google Drive Folder but doing that manually is painful because you need to update when there is new files or changes.
With onleetable and Google Apps Script you can create a nice files cabinet for your site and make it dynamic, setup one time and just put or remove file into the Drive folder and it will be updated automatically on the site. On this page we will share the apps script code to extract automatically the data from the drive folder, make it dynamix with automatic update and details the onleetable setup.
In just a minute you will have an amazing dynamic files cabinet.
Automatically create Google Sheets with files details from your Drive folder
⚠️ We assume first the folder is shared with appropriates persons, your domain or is public.
To create files cabinet with onleetable, you need first to extract files details from the folder. Please do :
1 - Create a Google Sheets : link
2 - Create a copy of the script : link
3 - On the script page, click on the copy icon on the right.
4 - In the script replace the folderId (line 4) and sheetId (line 6) variable by the ID of the Drive folder and the ID of the new Sheets created.
5 - Run the function createFileCabinet() a first time to validate scope. Select the function in drop down and click "Run".
6 - Run the function again.
7 - To automatically update Sheets with new files added or udpate information, select the function createTrigger() in the drop down and click Run. This will automatically check the folder each hours and update the Sheets.
⚠️ For the preview column you will not see the preview picture, it is normal. Google Sheets have difficulties to render the preview but on the onleetbale it will be fine.
You have now setup the script to update your Sheets when there are changes in the folder to always have an updated information in the Sheets. Now with onleetable you will be able to create a beautiful files cabinet based on the Sheets and always up to date.
Create Files Cabinet with onleetable
2 - Open the add-on from your Google Sheets, click the icon on the right. First time you have to validate access to the file.
For the settings keep just the "Tab" selection.
You don't need to select a specific range, onleetable will automatically adjust to the number of rows. By this way if there is a new file you don't need to update the range it will be automatically reflected in the Files Cabinet.
3 - Go to Design, expand the menu by clicking the button. Then select "Card".
4 - Click "Create" button at the bottom of the add-on.
And voila, you now have generated a files cabinet with onleetable. The url is available at the top of the add-on.
If you want to change some settings don't forget to click the "Save" buttons, there is no automatic save.
Your files cabinet is ready
Now you have a scritp that will run automatically each hours and will update the Sheets with new information and new files you add to the folder.
The change are instantly replicated to your onleetable to display the last and accurate information to the visitors or your co workers.
This page can be embedded in a website, your wordpress or in a new Google Sites like below.
Customize the script
You can customize the fields you want to display, for that you have 2 things to do.
First, in line 13, add or remove the name of the column you want to modify :
results.push(['Preview','Title','Owner','Last change','Modified by','Size','Link'])
Second, in line 27 and 28 add or remove the item you want to modify :
You can have a detail of all fields available there : link
For example if you want to add the file description you just add a column "Description" and you add the value file.description, here the result :
Line 13 :
results.push(['Preview','Title','Description','Owner','Last change','Modified by','Size','Link'])
Line 27 and 28 :