Accessing binary data

Hi,

I am trying to download and access the text inside an XML file attachment in an Outlook email. I can get the email, and the attachment shows in the UI with a ‘Download’ button, but I can’t read the content in future nodes. I have tried using {{ $binary.data.fileName }} and {{ $binary.data }} and tried ‘extract from file’ and ‘convert to file’ nodes with no luck.

I either get a successful run with no error but no data field, a ‘value is not set’ error when using {{ $binary.data.fileName }} or an ‘[object Object] not set error’ when using {{ $binary.data }}.

While it is an XML text file, and I can download it manually and read the content using the Download button to confirm this, the mime type is showing as ‘application/x-msdownload’ and there is no preview/view button like there is for other attachements, if that has anything to do with it?

Please share your workflow

This is all run on the cloud version of n8n

EDIT:

I can see the downalod button for the file in the UI, which works fine. But in the schema there is no reference to the data or any download URL:

Hey @AndymWB hope your day is going well.

I see you are able to download the attachment from your email and would like to access its content? What do you wish to do with that content?

Here is how you can simply have access to the text of the xml in the future nodes:

Above you can see the email with an attachment. In the next node, we extract from that attached binary:

as you can see the output is a text of an XML, which you can use in future nodes.

Hi Jabbson,

Thank you so much for getting back to me! Unfortunately I’m not getting the same results, I’ve simplified my workflow down to try and match what you have and included it below.

I think that something to do with the way Outlook is supplying the file as ‘application/x-msdownload’ mime type rather than text/xml might be something to do with it, notice the output is more downloadable files and not the XML text…

And here is my simplified workflow:

My goal is to be able to parse and use AI to then review the content of the XML file so I wanted to first access the content.

On the screen with Extract from File, could you click on ANY other tap, other than Binary on the right side - Schema , Text, JSON…

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