Giter Site home page Giter Site logo

excellentexport's Introduction

ExcellentExport.js

JavaScript export to Excel or CSV

A quick JavaScript library to create export to Excel/CSV from HTML tables automatically in the browser. No server required.

Check my blog page for testing: JavaScript export to Excel

ExcellentExport.js update: JavaScript export to Excel and CSV

Revision history:

1.0

  • Added Excel data export

1.1

  • Added CSV data export

1.3

  • Added minified version.

1.4

  • Add LICENSE.txt with GPL v3.
  • UTF-8 characters fixed.

1.5

  • Possibility to select a CSV delimiter.
  • Bower package available.
  • Compose package available.

2.0.0

  • Now it can export to big files +2MB.
  • Minimum IE 11.
  • Links open with URL.createObjectURL(...).
  • NPM package available.
  • Using Semantic versioning (2.0.0 instead of 2.0).
  • Module can be loaded standalone or with RequireJS.
  • Change license to MIT.

2.0.2

  • Fix CSV Chinese characters and other special characters display error in Windows Excel.
  • Fix URL.createObjectURL(...) on Firefox.

2.0.3

  • Fix export as a module.
  • Changed minifier to UglifyJS.

Compatibility

Firefox, Chrome

It does not work on Internet Explorer yet. Internet Explorer does not allow to use url data schema on links.

Install: Bower

bower install excellentexport

Install: NPM

npm install excellentexport

Install: Composer

Get Composer:

$ curl -s http://getcomposer.org/installer | php
$ php composer.phar install

Create a composer.json file for your project:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/jmaister/excellentexport"
        }
    ],
    "require": {
        "jmaister/excellentexport": "~1.4.0"
    }
}

Run composer install.

Include script in your HTML:

<script type="text/javascript" src="/components/excellentexport/excellentexport.min.js"></script>

Usage

<table id="datatable">
    <tr>
        <td>100</td> <td>200</td> <td>300</td>
    </tr>
    <tr>
        <td>400</td> <td>500</td> <td>600</td>
    </tr>
</table>

<a download="somedata.xls" href="#" onclick="return ExcellentExport.excel(this, 'datatable', 'Sheet Name Here');">Export to Excel</a>
<a download="somedata.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable');">Export to CSV</a>

Notes

IE8 or lower do not support data: url schema. IE9 does not support data: url schema on links. IE10 and above and Edge are supported via the Microsoft-specific msOpenOrSaveBlob method.

Test

python -m SimpleHTTPServer 8000

Security

Due to a Microsoft patch, Excel files generated by excellentexport can only be opened if they are trusted, otherwise users get a blank window. See Microsoft's forms, and Freya's answer for more details : https://social.technet.microsoft.com/Forums/en-US/d2d84793-9920-45e3-baef-5027a4ac1ae0/kb3170008-for-office-2016-breaks-functionality-ms16088

excellentexport's People

Contributors

jmaister avatar plachance avatar erunamojazz avatar jehon avatar aureliojargas avatar bjarneheden avatar unabashed avatar wucao avatar

Watchers

James Cloos avatar Tom avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.