Get gmail binary , but no binary?

Hi,
Objectif : catch gmails with label " correction". texte to a file.txt and attachment to Gdrive. Focusing on the gmail attachment to … somewhere.

Once in a while (manuel for now)
node Gmail :
get all ( limit 2 for now) Gmail with label “correction”
A- full → payload json/table
B- Raw → huge 4.8M, and very raw
C- Resolved → Nice ! Can be viewed or dl !
Sems ok.

But next node ( tried GDrive then simplified to only Write Binary File) says
A-if all the node “raw” :
{{$node[“Gmail”].binary.attachment_0}}
ERROR: The binary property “[object Object]” does not exist. So no file can be written!
B-only filename :
ERROR: The binary property “IMG_20220906_185019.jpg” does not exist. So no file can be written!

I tried with full
A-{{$node[“Gmail”].json[“payload”][“parts”][0][“body”][“data”]}}
B-{{$node[“Gmail”].json[“payload”][“parts”][1][“body”][“attachmentId”]}}

ERROR: No binary data set. So file can not be written!

and with raw
{{$node[“Gmail”].json[“raw”]}} which neither n8n nor me did like apparently.

a ghinary ? ghost binary file ?
need another node?

Hey @Joel_T,

I feel like there is a lot missing here but as a test can you add the google drive node after the gmail node and for the binary property just put in attachment_0 and see if that works.

Hi Jon,
Please define " feel’ and “lot”… if you mean the script is missing some nodes, yes, it is, as writen.
As past tests, it’s not working with the gmail ( hence the just plain idiot “write binary file”) but, being a ggod boy, I tried again ( actually, copied 3 times Gmail-raw, Gmail-resolved, gmail-full and binded each to a different gdrive node.in order to understand firstly where owuld be “attachment_0”. seems to be gmail-resolved.
1- If I run one of the three, the others will “unscript” even if 3 separate entities.
2- if you were meaning gmail resolved, as it seems after testing,( but I ran the others as well with the same success) it is a " ERROR: No binary data property “[object Object]” does not exists on item!"
{
“nodes”: [
{
“parameters”: {
“authentication”: “oAuth2”,
“binaryData”: true,
“binaryPropertyName”: “={{$node["Gmail-resolved"].binary.attachment_0}}”,
“name”: “=sd”,
“resolveData”: true,
“options”: {}
},
“name”: “Google Drive”,
“type”: “n8n-nodes-base.googleDrive”,
“typeVersion”: 1,
“position”: [
100,
420
],
“credentials”: {
“googleDriveOAuth2Api”: {
“id”: “11”,
“name”: “Google Drive account”
}
}
}
],
“connections”: {}
}

Hey @Joel_T,

By a lot missing I mean what version of n8n are you running, how is it running and can you share the workflow?

Having the workflow will show what you are doing and we should be able to work from that to get it working.

as for the version, it is 0.182.0
btw, I have my previous script ( from older version) which are still visible in the open panel, but can’t be accessed…

Hey @Joel_T,

Can you try the workflow below, I have given it a test here and it works. When it comes to using binary data to upload sometimes using an expression doesn’t work so you have to just type in the incoming property name which in this case is attachment_0.

HO, that works !! Thanks.
and thanks for the explanation, wasn’t logic to me ( exception in grammar, as a french, should be used to it)
I’ll write it down on my own n8nDoc.

1 Like