PCG logo
Article

Automatically Save Labeled Emails to Google Drive

Emails can already be organized well in Gmail by assigning labels and grouping them into one or more topics. The following script goes one step further and automatically stores additionally labeled emails in specific folders in Drive. The emails are stored once as a PDF or, if attachments are present, as a ZIP file. This automation makes it even easier to keep up with your most important files. At the same time, other users can be given access to information stored in Drive.

The only thing left for you to do is label emails, deposit folders in Drive and run the script.

image-2d729cf4b69c

You can download the script hereExternal Link.

Application

To run the script,

  • Click Publish -> Set up as web app in the menu
  • Under Execute the app as: you can select under which authorization the application should run. In this case, select User accessing the web app.
  • Under Who has access to the app: you can limit the visibility of the app to your organization by selecting Anyone within....
  • Then the app can be accessed at the specified URL (Current web app URL:) and shared with appropriate people or the organization.

In the opened window, the label assigned in Gmail and the folder can now be selected as the storage location under the New Rule section. It is possible to run the script once, with the saved emails limited to a number of five per execution, or automated every five minutes. The automation can be stopped at any time. The executed rule is removed by clicking x.

The limitation to 5 emails per run is stored because a maximum of 1500 documents (PDFs) can be created in Google Drive per day. If the script runs every 5 minutes and you want to store several 10,000 emails in Google Drive, this is possible, as "only" 1440 documents are created per day this way.

image-9d19a9c53975

All steps are documented again under the blue information icon.

Already saved emails are marked in Gmail with a label (default name: "#"). In the script under Code.gs, section Globals, the label name for the already saved emails can be customized:

Do you have any questions or suggestions? Feel free to contact us!


Services Used

Continue Reading

Case Study
Media & Entertainment
Setting the stage for Google Workspace

GOP Entertainment replaced its outdated collaboration infrastructure and introduced Google Workspace. The company now benefits from significantly improved collaboration with the cloud-based solution.

Learn more
Article
Windows apps for ChromeOS: Easy deployment

What the acquisition of Cameyo by Google means for ChromeOS users.

Learn more
News
Ippen Digital Chooses Google Workspace

Ippen Digital, Europe's largest regional news network, embraced Google Workspace for seamless collaboration and enhanced productivity.

Learn more
News
Cloud Native Rockstar Award 2022

Benny Woletz earns recognition for excellence in the 'New Work & Collaboration' category for our solution for air conditioning specialist Viessmann.

Learn more
See all

Let's work together

United Kingdom
Arrow Down