I'm using the PHP SDK for the new Gmail API. How do I fetch an attachment from an email?
Here is the API documentation, but in this instance, it's missing example for PHP. Although I have seen people achieving this with PHP.
EDIT:
This is what I have so far, unsure if it's correct:
$attachmentData = $service->users_messages_attachments->get($emailAccount, $messageId, $attachmentId);
$myfile = fopen("excel.xlsx", "w");
fwrite($myfile, $attachmentData);
fclose($myfile);