This Google Apps Script allows users to insert images from a specified Google Drive folder into a Google Sheet.
- Preview Sort Order: Before inserting images, you can preview the order in which files will be sorted.
- Batch Processing: The script processes images in batches to handle large numbers of files efficiently, 75 images at a time.
- Progress Tracking: A checklist shows the current stage of the process.
- Resizing: Images are automatically resized to maintain quality while keeping file sizes manageable.
- Open Google Sheets.
- Create a new Google Sheet or open an existing one.
- In your Google Sheet, click on
Extensions
in the menu bar. - Select
Apps Script
from the dropdown menu. This will open the Apps Script editor in a new tab.
- In the Apps Script editor, delete any code in the
Code.gs
file under theFiles
section. - Copy and paste the code from the Code.gs file in this repo into the
Code.gs
file. - Save the script by clicking the disk icon or by pressing
Ctrl + S
(Cmd + S
on Mac).
- In the Apps Script editor, click on the
+
button next to theFiles
section. - Select
HTML
and name the fileindex
. (must be lowercase, do not include an extension). - Copy and paste the code from the index.html file in this repo into the
Index.html
file: - Save the HTML file by clicking the disk icon or by pressing
Ctrl + S
(Cmd + S
on Mac).
- Go back to your Google Sheet, you can close the Apps Script editor tab if you wish.
- Refresh the web page (by clicking the refresh icon or by pressing
Ctrl + R
orCmd + R
on Mac). - Click on the new
Custom Tools
button in the menu bar. - Select
Insert Thumbnails from GDrive
.
- On first run, in that Sheet, you may be prompted to authorise access to your Google Drive by the script (see Security Prompt).
- In the "Folder URL" field, enter the URL of the Google Drive folder containing the images.
- For example:
https://drive.google.com/drive/folders/1bRNBR55227gdQc-3_jhfsef_5R80RjAt
< Not a real URL
- In the "Start Row" and "Start Column" fields, enter the starting row and column for the images to be inserted.
- Click
Insert Images
to begin the process.
- Once the script starts running, you'll be able to press Stop to stop the script.
- Additionally as the script runs it'll show a checklist of progress under the Stop button.
- NOTE: The script will NOT stop running if you close the window, only if you press the Stop button.
On first run, in that Sheet, you may be prompted to authorise access to your Google Drive by the script.
Up to you if you feel like the security is too permissive, the full code is here to see and audit.
If you encounter any issues:
- Make sure you have the necessary permissions for both the Google Sheet and the Google Drive folder.
- Check that the folder URL is correct and accessible.
- If the script stops unexpectedly, try running it again. There may be temporary issues with Google's services.
This project is licensed under the GPLv3 License - see the LICENSE file for details.