Gmail – way to easily aggregate the content of many gmail messages into one document

gmail

I have several hundred emails, each in their own conversation (they are old emailed versions of posts from a blog which is no longer available online). I'd like to aggregate their content (i.e. message bodies) into one large document. I'm not too picky about the format but I guess a pdf would be nice. I can construct a search in gmail so that the only emails matching the search will be those that I want to aggregate.

Is there any way to easily do this? I'm open to writing something using the gmail API, but would obviously prefer a simple solution if that's possible.

Best Answer

The messages that are grouped in a conversation could be saved as a single file or forwarded.

The messages that are not part of a conversation or a large number of conversations, should use something else to be saved or integrated in a single file. Fortunately there a lot of tools and examples of Google Apps Scripts, but I don't know if there is one that to "the trick" in one step. I think that this will require two major steps.

  1. Create documents for each conversation or message.
  2. Merge the documents into a single document.

Bear in mind that some file formats have their own caveats to managing large content, so instead of having one single file could be better to rely on the file management and indexing features of the operative system or services like Dropbox, Google Drive, OneDrive, among others.

For Gmail messages that are grouped in a conversation
From Print mail

To print an entire conversation: Open the conversation you want to print. Click the "Print all" button Print icon, located above your message pane.

This will show a "printable" version of the conversation. You could "print" them as PDF or save the resulting page in other formats.

From Forward messages

Forward an entire conversation
1. Open the conversation.
2. Click the More button in the toolbar above your messages and select Forward all. enter image description here
When you forward an entire conversation, all messages from the conversation are put into a single message. Each message is clearly marked and listed in chronological order, from oldest to most recent, so that the conversation is easy to read.

Other tools and Google Apps Script examples
IFTTT If labeled "drive" in Gmail then save to Google Drive.
(more could be be added later)