Skip to content

tyolab/table-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED

Please use https://github.com/tyolab/table-exporter-ts

table-exporter

Export HTML Table (Table Tag, Table CSS) to a file (JSON, CSV, etc.)

Usage

node bin/export_table table.html 

Examples

var exporter = require('table-exporter');

/**
 *  exporter = function (html, tableSelector, targetSelector, callback)
 */
 var html = `<html>
                <body>
                    <table>
                        <tr>
                            <th>Column One</th>
                            <th>Column Two</th>
                            <th>Column Three</th>
                        </tr>
                        <tr>
                            <td>Row 1 Col 1</td>
                            <td>Row 1 Col 2</td>
                            <td>Row 1 Col 3 </td>
                        </tr>
                        <tr>
                            <td>Row 2 Col 1</td>
                            <td>Row 2 Col 2</td>
                            <td>Row 2 Col 3</td>
                        </tr>
                        <tr>
                            <td>Row 3 Col 1</td>
                            <td>Row 3 Col 2</td>
                            <td>Row 3 Col 3</td>
                        </tr>
                    </table>
                </body>
                </html>`

 var tables = exporter.export(html);

// output is an array of table that are found
// for example
// tables === [{"headers":["Column One","Column Two","Column Three"],"rows":[["Row 1 Col 1","Row 1 Col 2","Row 1 Col 3 "],["Row 2 Col 1","Row 2 Col 2","Row 2 Col 3"],["Row 3 Col 1","Row 3 Col 2","Row 3 Col 3"]]}]

Use in a brower

Install Browserify

npm install --global browserify

Produce Table Exporter Javascript Bundle

browserify web.js -o web/te.js
<!DOCTYPE>
<html>
    <head>
    <script src="../te.js"></script>
    </head>
    <body>
    </body>
</html>

Chrome Extension

Please go the chrome folder, and manually install the extension

Maintainer

Eric Tang @ TYO Lab

About

Export table into csv from html page

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •