ChatGPT fails a lot, but the reason millions of us use it is because, when it works well, there is nothing else like it.
I had that experience recently when I was struggling with a seemingly simple Gmail issue. In short, my inbox was out of control, with six figures of unread messages, and the mere presence of that number was a daily reminder of my poor household management.
None of those unread emails were particularly important. I had been tagging and responding to cues, and using filters to surface must-reads. But I let the weeds completely overwhelm the Gmail flower bed and it was time to get out the trowel.
No problem, I thought, I’ll just take the nuclear option and do a giant ‘select all’ and ‘mark all as read’ to have a clean slate. Except doing that, in many variations, didn’t work. Apparently Gmail has a secret internal limit for bulk operations, and I was well above that number.
Even doing it in batches using Gmail’s search operators didn’t work. My ridiculous inbox had apparently broken Gmail’s brain and Google couldn’t help.
Fortunately, this is where a tool that I now treat like an eccentric uncle (incredibly smart in some ways, worryingly wrong in others) came to the rescue…
Going off script
I found ChatGPT to be a huge help when it took my poorly worded message and found a solution that would never have crossed my mind in a million years. This usually involves coding.
For my problem with Gmail, they suggested me to use Google Apps Script. This platform is something I’ve never heard of (partly because it’s a Google Workspace thing), but it’s apparently an unsung hero for automating simple tasks, particularly in apps like Docs, Sheets, and Gmail.
I’ve since learned that people use Gmail Apps Script to automate all kinds of things, from business management to giveaway spreadsheets for friends. But it was also the trick I needed to get around Gmail’s stubborn limits for bulk operations.
After the usual back and forth with ChatGPT, he perfected a little script that would search my Gmail inbox for chunks of 500 unread threads and mark them as “read,” until I reached the “inbox zero” nirvana that I assumed would be much easier to achieve.
The process was as simple as going to Google Apps Script, clicking ‘New Project’, pasting the script (which ChatGPT assured me was “fully balanced and tested”), clicking the ‘Save’ icon, and then hitting the ‘Run’ button. The script started playing in the background and I watched as my inbox slowly reached zero.
How to use ChatGPT?
ChatGPT doesn’t pull its wisdom out of thin air and I have no doubt that its Gmail solution (perhaps much of the script itself) was “inspired” by threads from the likes of Stack Overflow and Google Support.
The thing is, searching on Google didn’t turn up any of them and I was left going around in circles before ChatGPT intervened. The other great strength of chatbots (again, when they do things right) is that they can adapt solutions and code to your exact situation.
That doesn’t mean you shouldn’t double-check everything they say, and I had a bit of trepidation running a script I didn’t fully understand on my Gmail account. But after scanning the very basic code for any problems, I was happy to give it a try, and I’m glad I did.
For me, this slightly dry but useful exercise summed up how I currently use chatbots like ChatGPT, and it seems like I’m the majority. A recent study highlighted by Search Engine Land suggests that a whopping 95% of ChatGPT users still use Google; In other words, the chatbot is a Google add-on rather than a replacement.
ChatGPT is, as I mentioned above, that eccentric and sometimes genius guy I go to with thorny problems that I just can’t solve using pre-chatbot techniques. And while I certainly don’t trust its recall of news events (a recent BBC study found that 45% of AI chatbot responses around news had a “major problem”), I’ll always return to it for those flashes of inspiration.
If you’re in a similar Gmail inbox conundrum as me and want to try a (possibly over-engineered) solution to get to inbox zero, here’s the Google Apps Script code that worked for me (thanks, ChatGPT). My only challenge now is to stay there.
function markAllAsReadSafe() {
var searchBatchSize = 500; // how many threads to request from Gmail at once
var apiMax = 100; // GmailApp.markThreadsRead accepts at most 100 threads per call
var totalMarked = 0;
do {
// get up to searchBatchSize unread threads (newest first)
var threads = GmailApp.search('is:unread', 0, searchBatchSize);
if (threads.length == 0) break;
// process in sub-batches of apiMax
for (var i = 0; i < threads.length; i += apiMax) {
var slice = threads.slice(i, i + apiMax);
try {
GmailApp.markThreadsRead(slice);
totalMarked += slice.length;
} catch (e) {
Logger.log('Error marking threads read for slice starting at ' + i + ': ' + e);
// pause briefly and continue
Utilities.sleep(2000);
}
// small pause to reduce chance of throttling
Utilities.sleep(500);
}
Logger.log('Marked ' + totalMarked + ' threads so far.');
// loop continues if Gmail returned a full batch (means there are probably more)
} while (threads.length === searchBatchSize);
Logger.log('Finished. Total threads marked read: ' + totalMarked);
}
Follow TechRadar on Google News and add us as a preferred source to receive news, reviews and opinions from our experts in your feeds. Be sure to click the Follow button!
And of course you can also follow TechRadar on TikTok for news, reviews, unboxings in video form and receive regular updates from us on WhatsApp also.




