HTML Excel or CSV link info

Good morning,

I am building out a personal link HTML & CSS page with likes to servers I want to connect to. I have an excel spread sheet with all the information Location, FQDN, Hostname, IP Address, etc. I have built few pages by hand taking much time, just copy and pasting, then verifying everything is correct. There are separate tables for the different groupings.

“<td><a href=”/h___s://FQDN" target=“_blank”>Hostname</a></td>"

What I would like to do since I have everything already in an excel sheet is to call out the excel file, then call out the sheet then the columns. This would help when updating the file when servers are changed or added as well.

(Something like this?)
(<link rel=“spreadsheet” href=“./data/server.xlsx”>)

(“<td><a href=“h___s://[SERVER](a1)” target=”_blank">[SERVER](a2)</a></td>")

Is something like this possible? Is there a better way to do this?

Thank you.

What you describe is certainly possible, but how you go about it will depend on the specifics of your project. At a high level, you could use a script (Node, Python, etc.) to read the contents of the CSV then output an HTML chunk or file. This HTML can then be incorporated into your page as needed. In this setup, you would run the script each time the contents of the CSV change to rebuild the HTML.

There are more advanced versions of the same concept. If you already have a server, you could have this process occur as-needed which would make the page update dynamically (no rebuild needed each time). You would essentially be treating the CSV like a mini database that your server can access. This is more complicated, and if you are new to development, I would start with the simple version first.

In either case, I recommend using CSV if possible as they are substantially easier to parse. Some languages even have csv read/write modules built into their core packages.

Hope that helps. If you have more details about your project, your language preferences if any, what you’ve tried so far, etc., I’m sure folks can help more.

I can do CSVs files.

I do not have a web server to run the site on.

What I am doing is creating the pages with a linked CSS style, to make it pretty. Then zipping that and putting it on the other remote terminal servers I am working on. I work on multiple servers depending on the environment.

Company policy keeps removing favorites from Edge, Chrome and Firefox. They are working on correcting it but since I am in IT we are the first group to test and work out the bug for the last few months. With that I have created pages with links to simplify tasks, but creates duplicate inputs.

My initial thought was I could create the pages and use the CSV files as the updating file, I already keep it up to date. It wold make it easier to search pages or table to update each entry using one spot.

I work more with networking , servers, connections and not much of a coder.
With that info, what options is best solution?

So here’s one approach with some boilerplate. I used python for easy access to the built-in csv module and because it’s generally available, but you could do something similar in node, go, etc. as needed.

test.csv:

Location,FQDN,Hostname,IP
l1,f1,h1,i1
l2,f2,h2,i2

test.py:

import csv

table_rows = []
with open('test.csv', encoding='utf-8-sig') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        ip = row['IP']
        hostname = row['Hostname']
        table_rows.append(f'<tr><td><a href="h__s://{hostname}">{hostname} at {ip}</a></td></tr>')

html_output = """
<html>
<body>
<table>
""" + '\n'.join(table_rows) + """
</table>
</body>
</html>"""

with open('output.html', 'w') as f:
    f.write(html_output)

then:

$ python3 test.py
$ cat output.html
<html>
<body>
<table>
<tr><td><a href="h__s://h1">h1 at i1</a></td></tr>
<tr><td><a href="h__s://h2">h2 at i2</a></td></tr>
</table>
</body>
</html>

You would need to run the python script and upload the resulting html when the csv changed, but hopefully this is a proof of concept for ya and can get you started. Obviously the HTML would need to match whatever you want to display rather than my example values, but you can see how the template would work.