A Google Apps Script that automatically extracts all images from a Google Doc and saves them to a specified Google Drive folder.
- Extract all images from a specified Google Docs
- Convert images to PNG format
- Automatically creates a new folder for the images if no destination is specified
- Name each image using the document name and an incremental number
- Error handling for files without parent folders and documents with no images.
- Provides execution logs for monitoring.
Extract images from a Google Doc and save to a new folder
getDocImages("YOUR_GOOGLE_DOC_ID_HERE");
Extract images from a Google Doc and save to a specific folder.
getDocImages("YOUR_GOOGLE_DOC_ID_HERE", "YOUR_DESTINATION_FOLDER_ID_HERE");
- Open Google Apps Script at script.google.com
- Create a new project
- Copy and paste the script code
- Modify the document ID in the
runExtraction()function - Run the function
- Open your Google Doc
- Go to Extensions > App Script
- Copy and paste the script code
- Save the project
- Run the
runExtraction()function
The script works by:
- Finding the specified Google Doc
- Extracting all images from the document's body
- Creating a folder for the images(or using a specified folder)
- Converting each image to PNG format
- Saving the images with organized naming
Feel free to submit issues or pul requests to improve the script.