This post is an addendum to my "Using SVG 'interface' images" tip which you can find here:
https://www.googlecloudcommunity.com/gc/Tips-Tricks/Using-SVG-quot-interface-quot-images/m-p/504387
I introduced that tip as follows: "If . . . you would like to have a small subset of images appear immediately, regardless of your internet connection but, for some reason, cannot or do not want to store all of the images that may be added to your app by users, this tip may help you."
Then, toward the end of the tip I wrote as follows:
When I wrote this tip, I was not aware of @GreenFlux 's SVG Icon Tool, which converts SVGs to AppSheet format. To reduce the amount of text you put in your spreadsheet, I have come to the conclusion, thanks to comments by @jyothis_m , @Fabian_Weller and others, that it is generally preferable to use the SVG Icon Tool to prepare SVGs for insertion in a spreadsheet than to use base64.
Indeed, @GreenFlux 's SVG Icon Tool has proved to be invaluable. Today, however, I learned how to further reduce the size of my SVG images without sacrificing quality. I got AI (either ChatGPT or Claude will work, and probably others I haven't tried yet) to help me make an app that takes the Data URI text strings I'd received from SVG Icon Tool and further optimize them. This led to my file sizes being reduced by about 1/2 to 1/3.
I am not a good enough coder to do this without AI but now, with assistance from AI, I have lots of little apps that take care of tasks like this for me. Whether you are a Mac user (like me) or a Windows user, I think you can make a similar app that will help you reduce the size of any Data URI SVG files you've placed in your spreadsheet.
Here are the instructions that I asked ChatGPT to put together:
This guide provides structured prompts to help users create an app that optimizes SVG Data URI files by removing unnecessary data and improving compression. The app will allow users to drag and drop a text file containing an SVG Data URI and receive a new, optimized text file in the same directory.
The process relies on:
If users do not yet have these tools, installation instructions are included.
Use these prompts step-by-step to generate a fully functional automation script for Mac or Windows.
(Same for both Mac and Windows)
Prompt:
"Help me install the required software for optimizing SVG Data URIs. I need Node.js and SVGO. Provide step-by-step instructions for downloading and installing them."
Expected Response:
npm install -g svgo
node -v
svgo --version
(Same for both Mac and Windows)
Prompt:
"I have a text file that contains an SVG in Data URI format (e.g., data:image/svg+xml;utf8,...
). I need a script that extracts the SVG content, optimizes it using SVGO, and converts it back into a Data URI. The script should create a new text file in the same directory as the original with _optimized
added to the filename. Provide a script for this."
Expected Response:
filename_optimized.txt
).(For Windows, we use PowerShell and a batch file for drag-and-drop support.)
Prompt:
"I need a Windows script that allows drag-and-drop functionality for optimizing SVG Data URI text files. The script should use PowerShell to process the file, call SVGO, and save the result as a new text file in the same folder. Provide a PowerShell script and a batch file that lets users drag and drop a file onto it."
Expected Response:
PowerShell Script (OptimizeSVG.ps1
)
Batch File (OptimizeSVG.bat
)
(For Mac, we use Automator and a shell script for drag-and-drop support.)
Prompt:
"I need an Automator workflow that allows drag-and-drop support for optimizing SVG Data URI text files. It should extract the SVG, optimize it using SVGO, and save the result as a new text file in the same folder. The workflow should start with 'Get Selected Finder Items' to allow drag-and-drop functionality. Provide the necessary shell script for this Automator action."
Expected Response:
Automator Workflow:
Shell Script (inside Automator's Run Shell Script):
(Different methods for Mac and Windows)
Windows Prompt:
"Modify my PowerShell script to display a Windows Toast Notification after optimization, showing the number of files optimized and any errors."
Mac Prompt:
"Modify my Automator workflow to display a macOS notification after optimization, showing success or failure."
Expected Response:
New-BurntToastNotification
for a Windows toast notification.osascript -e 'display notification ...'
for a macOS pop-up.(Same for both Mac and Windows)
Prompt:
"Modify my script to create a log file that records each processed file, the original size, the optimized size, and any errors."
Expected Response:
svg_optimizer_log.txt
file.(Same for both Mac and Windows)
Prompt:
"Modify my script to generate an HTML preview file that visually compares the original and optimized SVGs. The HTML should display both versions side by side."
Expected Response:
By following these AI-generated prompts, users can create a fully functional, drag-and-drop app for SVG Data URI optimization on both Mac and Windows. Each system uses its native automation tools while achieving the same functionality.
P.S. I wrote this to report how I made an app that is helping me reduce the size of images I have already put in my Google spreadsheet for use in my app. If I were to start from scratch, however, I might trying making an app that would start with a png image I'd like to use, and go directly to the sort of highly optimized Data URI I need for me app. I've made a similar app to convert screenshots (png) to WebP files that works very well.
By the way, WebP stored on my server displays nicely in AppSheet apps (that is, as a "browser" AppSheet is "WebP ready") but, unfortunately, images uploaded to AppSheet via the app become jpg images. I say this is unfortunate because png screenshots are must smaller but not visually degraded when converted to WebP but those advantages are lost when WebP is converted to jpg.
Good one but i use slightly different method than this. My setup generates url and url can be dynamically passed similar to this: https://www.clickminded.com/button-generator/
And URL will look like this: https://dabuttonfactory.com/button.png?t=Your+CTA+copy&f=Open+Sans-Bold&ts=26&tc=fff&hp=45&vp=20&c=1...
For example here is the screenshots:
All those values are dynamic in the url
In the app i can pass any values, colors, however I need to dynamically change the UI within the SVG.
I will look like this in the app
Here is an example url:
Cool!
Thanks again, @Rifad ! I downloaded your image as an SVG and put it on a sever I own:
https://files.kirkmasden.com/2025/samples/Purchase-Order-Invoices-Header-Detail.svg
FileZilla says the file size is 1,830 bytes, already quite small.
Then I used another little app I made with the same optimization engine and tried to optimize it. Here's the result:
https://files.kirkmasden.com/2025/samples/Purchase-Order-Invoices-Header-Detail_optimized.svg
The file size (again according to FileZilla) is 1,362 bytes -- not a huge improvement (your file was already optimized) but still a reduction of about 25%. My impression is the SVGO is quite powerful.
Thank you very much @Kirk_Masden for further expanding the "SVGs in AppSheet apps" knowledge repository with your useful SVG optimization findings and neatly documenting those as per your customary style.