如何将Excel(CSV)数据导出到带有数据标题和数据类型的HTML表

时间:2016-11-23 16:26:36

标签: html excel csv datatable html-table

我在CSV文件中有这个庞大的运动员名单(833),包括他们的名字,球队名称和统计数据。

我创建了一个像这样响应的表:

<table class="responsive-table" id="my-table">
    <caption>AUDL Historical Stats</caption>
    <thead>
      <tr>
        <th scope="col">Name</th>
        <th scope="col">Team</th>
        <th scope="col">Plus/ Minus</th>
        <th scope="col">Completions</th>
        <th scope="col">Attempts</th>
        <th scope="col">Comp %</th>
        <th scope="col">Assists</th>
        <th scope="col">Goals</th>
        <th scope="col">Scores (G+A)</th>
        <th scope="col">Drops</th>
        <th scope="col">Blocks</th>
        <th scope="col">Hockey Assists</th>
        <th scope="col">Points Played</th>
        <th scope="col">Games Played</th>
      </tr>
    </thead>

    <tbody>

/* PLAYER ONE */

<tr>
        <th scope="row"></th>
        <td data-title="Team"></td>
        <td data-title="Plus/ Minus" data-type="double"></td>
        <td data-title="Completions" data-type="double"></td>
        <td data-title="Attempts" data-type="double"></td>
        <td data-title="Comp %" data-type="double"></td>
        <td data-title="Assists" data-type="double"></td>
        <td data-title="Goals" data-type="double"></td>
        <td data-title="Scores (G+A)" data-type="double"></td>
        <td data-title="Drops" data-type="double"></td>
        <td data-title="Blocks" data-type="double"></td>
        <td data-title="Hockey Assists" data-type="double"></td>
        <td data-title="Points Played" data-type="double"></td>
        <td data-title="Games Played" data-type="double"></td>
      </tr>

/* PLAYER TWO */

...

</tbody>
  </table>

而不是一次复制和粘贴一个数据。有没有办法通过添加&#34; data-title&#34;来导出?和&#34;数据类型&#34;到td标签,范围=&#34;行&#34;每个玩家的标签?

任何帮助表示赞赏!

0 个答案:

没有答案