There seem not to be a direct method/function to use attached files (eg. csv'ss, pdf's) within R environment without prior saving it localy.
Is there a workaround for this, like converting object of gmail_attachment class (without local save ofc.)?
Or am i wrong and there is a way to to do so already?
# Get list of emails
maillist = gmailr::gm_messages(search = 'yoursearch', user_id = 'me',)
# use latest email, create mail object
mail = gm_message(maillist[[1]]$messages[[1]]$id)
# get attachments from that email object
attachments = gm_attachments(mail)
# create attachment object
attachment = gm_attachment(user_id = "me",
id = attachments$id,
message_id = mail$id)
# Save
gm_save_attachment(x = attachment, filename = r'{downloads/name.csv}')
returns:
>attachment
...
attr(,"class")
[1] "gmail_attachment"