Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[reMarkable Tablet] Store converted handwriting text to RTF w/ Google Apps Script
/*
* reMarkable Text to Google Docs
*/
var EMAIL_ALIAS = 'email+alias@gmail.com';
var DRIVE_FOLDER_ID = 'your-drive-document-folder-id';
var REMARKABLE_LABEL = GmailApp.getUserLabelByName('your-label-name')
function StoreOnDrive() {
var BASE_QUERY = 'in:inbox to:'+ EMAIL_ALIAS +'';
var results = GmailApp.search(BASE_QUERY);
for(var index in results) {
var messages = results[index].getMessages()
if(messages.length > 0) {
for(var mIndex in messages) {
if(messages[mIndex].isUnread()) {
var messageContent = messages[mIndex].getPlainBody()
var messageSubject = messages[mIndex].getSubject()
DriveApp.getFolderById(DRIVE_FOLDER_ID).createFile(messageSubject, messageContent, MimeType.RTF)
messages[mIndex].markRead()
}
}
results[index].addLabel(REMARKABLE_LABEL)
results[index].moveToArchive()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment