I tried to clear the unread mail by using Google Apps Script



Google Apps Script (GAS) is a service that can be used to automatically process various data in Google Drive. You do not need to prepare a server, you can do it by writing code with JavaScript, so it can be used quite conveniently. For this time, refer to the article on the blog below and use GAS to run code to make all unread messages of Gmail read.

Clear out a lot of Gmail's unread in Google Apps Script - Bullet
http://fukurami.hatenablog.com/entry/2017/10/01/030917

Looking at the inbox, you can see that "8461" unread mails are accumulated.Official methodHowever, although you can make all unread mails read, this time we will do using GAS.


First, select "Drive" from the menu button in the upper right.


Click "New" in the upper left corner, and click "Add application" from "Other" at the bottom of the menu that came out.


Enter "google apps script" in the search field and click the "Connect" button to the right of the "Google Apps Script" that came out.


"Google Apps Script is connected to Google Drive" will be displayed, so click "OK".


Click "New", click "Other" again, and "Google Apps Script" has been newly added, please click.


The script edit screen opens. Delete "function myFunction () ~" which was originally input ... ...


Open the original source blog and copy and paste all parts of the gray background that are in a slightly scrolled place.


After pasting, press "Ctrl + S" to save the code. Then you will be asked to decide the project name. I entered "script to erase unread mark" here and clicked "OK".


Next, click "Execute button" of the triangle mark on the upper side.


Since you are asked for approval, click "Confirm permission".


Since you will be asked which account you want to run, select the account you want to mark as unread mail.


You will be prompted for access to data. Click "Allow" to run the script.


When you look at the application of the smartphone, you can see that the number of unread messages decreases while you are seeing it.

I deleted Gmail's unread mark using GAS - YouTube


As you can see from the movie, the execution speed is not so fast, it seems that it can process only about 200 in 1 minute. Therefore, if you try to process thousands of mails, you will be stuck with the restriction that GAS's 'script execution time must not exceed 5 minutes' limit. for that reasonBlog that had published codeSays that he created this "time triggered trigger" and avoided this restriction by allowing the trigger to execute the code.

in Review,   Software, Posted by log1d_ts