Convert Text field to Binary object for use with HTML node

Describe the problem/error/question

I need to scrape HTML data from an Email Trigger node and loop through the items in a table based on a css selector to get my Invoice Items (Desc, Qty, Price). The email node returns textPlain and textHtml and the HTML node expects Binary or JSON. How can I convert textHtml into Binary so I can use the HTML node to access my data?

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.42.1
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: Ubuntu Linux

Besides textHtml and textPlain we could also (or optionally) have a flag to generate a true HTML binary object that we could pump directly into the HTML node?

Hi @tim.berneman, binary data in n8n refers to any file-type data such (e.g. file attachments in your email) so if you want to access the email content, you’ll need to select Source Data > JSON. You should then be able to access the html content by setting the JSON Property to

{{ $('Email Trigger (IMAP)').item.json.html }}

I tried that but the “.html” field doesn’t exist. I get this error:

Thanks for your help, it’s much appreciated!

I think I got it to work, I’m getting my table data now. I just have to figure out the looping and parsing to get individual rows!

I thought I had tried this combination before but I must of missed something as this is working.

Thanks again!

1 Like

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