0

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?

Matt Ellis
  • 73
  • 5
  • What are you using? php? java? ASP? – Sari Alalem Feb 13 '16 at 10:59
  • @SariAlalem I am using the barebones html and css, with some Javascript? I havent started learning any php etc yet. – Matt Ellis Feb 13 '16 at 11:01
  • 2
    Well, to be able to process a file (Read its data), you either need a backend script/program to do that, which can be accomplished with php, java... etc. OR you can use html5/javascript File API, which is more difficult, see http://stackoverflow.com/questions/8238407/how-to-parse-excel-file-in-javascript-html5 – Sari Alalem Feb 13 '16 at 11:20
  • 1
    If you try to update the website from Excel sheet you can write VBA code which export the file's content into CSV file and then push it to the website with JavaScript – IgorM Feb 13 '16 at 14:16
  • Thanks for all the help guys – Matt Ellis Feb 14 '16 at 15:20

1 Answers1

1

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.

Hambone
  • 15,600
  • 8
  • 46
  • 69
  • there is even simpler solution. You can use CONCATENATE to HTML tags and them copy/paste the column with HTML into .htm file – IgorM Feb 13 '16 at 14:20