JSON data export Excel

Source: Internet
Author: User

Recently done a project involves the export of data into Excel, search the Internet to find, finally found two ways, nonsense not much to say

The first type:

Get the ID of the table can grab the data of the table, export to Excel, this method is simple and rude, introduce the two plug-ins can be.

But in this way there will be a problem, that is, when your table has paging, this thing can only crawl the value on the page, so do not say more, the other pagination is not derived, the value can export the current paging data.

However, the project requires that all data be exported, and there is a second solution

It is also relatively simple to use, to get the data directly inside the plug is, the last call method. In this case, all the data comes out eventually.

function Jsontoexcelconvertor (Jsondata, FileName, ShowLabel) {var arrdata = typeof Jsondata! = ' object '? Json.parse (jsondata): Jsondata; var excel = ' <table> '; Set table header var row = "<tr>" for (var i = 0, L = showlabel.length; i < L; i++) {row + = "<td>" + Showlabe L[i].value + ' </td> ';} Line-Wrapping Excel + = row + "</tr>";    Set data for (var i = 0; i < arrdata.length; i++) {var row = "<tr>"; for (Var j=0;j<arrdata[i].length;j++) {var = arrdata[i][j].value = = = = = = = "."?     "": arrdata[i][j].value;  Row + = ' <td> ' + value + ' </td> '; }
   excel + = row + "</tr>"; }   Excel + = "</table>";   var excelfile = "

JSON data export Excel

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.