How to use binary as variable through workflow?

Could you please explain what “binary” means in the context of your workflow? I received a BINARY file via IMAP email, which happens to be an Excel file. I would like to extract and analyze its content, and perform some additional actions.

In my case, it looks like this:

I’m not sure how to use this BINARY file in n8n. I can’t find it as a variable value in the VARIABLES SELECTOR, which I could use to access all the binary data.

Been using this type of workflow in and it was kinda clear… Now I don’t get it how to achieve the same with n8n.

Can anyone help me out with this?

hi @Saravicius!

You could use the “Read PDF” node to accomplish what you’re looking for, I believe - you can read more about it here.

Here’s a quick workflow with an example PDF I grabbed from a site for test data:

One caveat to note: This won’t work with a passworded file :see_no_evil:

1 Like

But the questions is not about that :slight_smile: Which value from previous NODES is a binary date to use. I don’t get it. As you see in my screenshot - there is:

  • File extension
  • File name
  • File size
  • MimeType

I don’t get which value is actual binary data (file)?

Hi @Saravicius

It depends a bit on what you want to do exactly. As you cannot simply grab the binary data and then add that into an email extension for example. Binary data is treated differently, except when you first convert it to json. This can be done with the “Move Binary Data” node.
If a node allows you to attach Binary data it will also give you that option and what you then reference is simply the name of the binary data. In you screenshot that would be attachment_0.
In the screenshot below the Source Key is the binary data name. (default is data but in your case could be attachment_0)


Seems like I am on right direction, just receiving an error

It’s a 4MB size XLS file.

HI @Saravicius

If you want to read the xls file you can use the spreadsheet node to read the xls.

I did’t realize is that simple :slight_smile: Leaving this screenshot here for future generations so everyone can understand that “data” = “data”

By the way, if there is several binary data attached how to run the cycle?



I think the Item lists node now has a way to split them into a list.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.