I have an excel file which contains data for football statistics and I want to be able to change the excel numbers, and in doing so the website updates its table automatically.
Is there a possible way to do this?
I have an excel file which contains data for football statistics and I want to be able to change the excel numbers, and in doing so the website updates its table automatically.
Is there a possible way to do this?
This doesn't completely answer your question, but I thought to include it as a partial answer. I have a generic procedure (method) I use from time to time to convert an Excel Table
(aka ListObject
) into an HTML table. Perl has a module that does this brilliantly, but I've never found anything similar for VBA, hence my hand-rolled code.
The only caveat is that your data has to be in a table. If it's coming from an RDBMS, then the easiest thing to do is to bring it in via MS Query, which automatically renders the output as a Table/ListObject.
I know you are talking about Web and made no mention of VBA -- just take this for what it's worth. I'm hopeful it has some useful components you can glean.
Function TableToHtml(ByRef Table As ListObject, Title As String) As String
Dim row As ListRow
Dim header, col As range
Dim output As String
output = _
"<html>" & vbCrLf & _
" <head>" & vbCrLf & _
" <title>" & vbCrLf & _
Title & vbCrLf & _
" </title>" & vbCrLf & _
" </head>" & vbCrLf & _
"<body>" & vbCrLf & _
"<font size=""5"">" & Title & "</font><br><br>" & vbCrLf & _
"<table border='1px' cellpadding='5' cellspacing='0' style='border: solid 1px Black; font-size: small;'>"
output = output & "<tr align='center' valign='top'>" & vbCrLf
Set header = Table.HeaderRowRange
For Each col In header.Columns
output = output & " <td align='center' valign='top'>" & col.Value & "</td>" & vbCrLf
Next col
output = output & "</tr>" & vbCrLf
For Each row In Table.ListRows
output = output & "<tr align='left' valign='top'>" & vbCrLf
For Each col In row.range.Columns
output = output & " <td align='center' valign='top'>" & col.Value & "</td>" & vbCrLf
Next col
output = output & "</tr>" & vbCrLf
Next row
Dim o As Object
output = output & "<tr align='left' valign='top'>" & vbCrLf
For Each header In Table.TotalsRowRange
output = output & " <td align='center' valign='top'>" & header.Value & "</td>" & vbCrLf
Next header
output = output & "</tr>" & vbCrLf
output = output & "</table>" & vbCrLf & "</body>" & vbCrLf & "</html>"
TableToHtml = output
End Function
Yes, this is pretty brute-force.