export html table to csv

后端 未结 8 2033
走了就别回头了
走了就别回头了 2020-12-07 18:20

I am trying to add a feature of csv download option in my website. It should convert the html table present in the website in to csv content and make it downloadable. Ive be

8条回答
  •  日久生厌
    2020-12-07 19:21

    I used Calumah's function posted above, but I did run into an issue with his code as poisted.

    The rows are joined with a semicolon

    csv.push(row.join(';'));
    

    but the link generated has "text/csv" as the content type

    Maybe in Windows that isn't a problem, but in Excel for Mac that throws things off. I changed the array join to a comma and it worked perfect.

提交回复
热议问题