Return to index link to github


Excel2Canvas is a library to display an Excel file on the web browser.

Its source codes consists of two parts.

  • Java. It is used to convert Excel file to JSON.
  • JavaScript. It is used to draw Excel view on the web browser.



At first, read an excel file and convert it to JSON string.

    ExcelToCanvasBuilder builder = new ExcelToCanvasBuilder();
    builder.setIncludeComment(true);//If need display comments.
    builder.setIncludeChart(true);//If need display charts.(Flotr2 is required.)
    builder.setIncludePicture(true);//If need display picture.
    String json = builder.build(new File("Book1.xlsx"), "Sheet1").toJson();

Next, embed JSON string to HTML, and apply jQuery plugin method to a div element that holding a canvas element.

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" media="screen,print" href="jquery.excel2canvas.css" />
    <script type="text/javascript" language="javascript"  src="flotr2.js"></script>
    <script type="text/javascript" language="javascript"  src="jquery.excel2canvas.min.js"></script>
    <script type="text/javascript" language="javascript"  src="jquery.excel2chart.flotr2.min.js"></script>
        $(function() {
        var data = ${excel.raw()};//Get the JSON string.(Template engine syntax.)
        $("#canvasHolder").excelToCanvas(data).css("width", $("#canvas").width());
    <div id="canvasHolder">
        <canvas id="canvas"></canvas>

You can see more detail on SlideShare.(Japanese only)


ExcelReport is an application that uses this library.

It allows you to display Excel form in the browser.

Followings are some of its samples.

Latest release

Download - 1.2.0


            <name>FLECT maven repository</name>