Adding Data to a HTML File

Hi,

I’m looking for some help please.

I have an HTML file that makes use of variables - today, my process consists of:

Workflow to create the values
Write the values to a CSV
Copy and paste values to the HTML file

I’m trying to automate this so the workflow adds the values directly to the HTML file.

I’ve been experimenting with the HTML parser and Web Page Content Extractor nodes, but (a) can’t get to where I need to get to, and (b) can’t help feel that I’m over-complicating the matter.

Does anyone have any ideas?

The image illustrates what I’m trying to achieve - I want to ‘append’ the section highlighted.

I appreciate any help and tips.

Thanks.

I would just store the HTML template as a column, and then add the dynamic content, e.g. through a String Manipulation node:

E.g. create a “template” like so:

<html>
<head></head>
<body>
<script>{{script}}</script>
</body>

And use the following expression in the String Replacer:

replace($template$, "{{script}}", $script$)

You can get an example workflow on my Space:

1 Like

@qqilihq thank you. I went for a walk to clear my head and realised I was approaching it the wrong way around. My thoughts were confirmed having seen your workflow. Good stuff.

How do I write that back out to a HTML file that will? I’m getting a table view when I view the HTML file, when I want to see the rendered file in Chrome.

Thank you again.

I went for a walk to clear my head and realised I was approaching it the wrong way around.

As the saying goes, “Life without liberty, is a life not lived, and life without truth, is a life not understood.”

You went out to seek for truth and truth appears before you :smile:

1 Like

@badger101 - I think I need to go out for more walks! :thinking:

2 Likes

You inspired me to do so too!

2 Likes

Probably quite a couple of options. Easiest one based on my NodePit search would be this one from the “Lhasa” nodes:

Hope this helps! :slight_smile:

1 Like