u/gabekkd

▲ 3 r/HTML

How can I use text files in HTML/JS as a condition trigger?

EDIT: Solved, I just had to edit the HTML directly, I was overcomplicating it a lot!

From what I've read, it doesn't look like it's possible to use local files in JS, but I don't know how else to do what I'm trying to do.

I have a block of text which needs to change depending on a condition. There are three possible outcomes, and I have already written a python program which writes to three files, setting the correct outcome to True. I'm sure this is the most convoluted way of doing it, but I'm brand new to HTML and I'm already comfortable in Python.

The condition which needs to influence the text isn't decided by the user, it just updates weekly based on external data which I'll have to find a way of downloading automatically or just do it manually every week, but I'm just stuck on this bit, because I don't know how to get the data I need into the website. I probably could rewrite the Python code in JS, but it's connected to a spreadsheet and I'm not confident enough in JS for that.

I get why I can't generally use files in JS but I just need to use the data in an if condition.

I'm open to hearing any alternative ways of doing the whole thing, even if I have to start over.

reddit.com
u/gabekkd — 8 days ago