An Excellent Pure JavaScript Spreadsheet Plugin: Luckysheet

Last Updated: 2020-06-07 22:14:21
Luckysheet
Overview
Luckysheet is a fully front-end online spreadsheet similar to Excel, featuring powerful functionality, simple configuration, and completely open-source code.
Features
Luckysheet supports spreadsheet settings including frozen rows and columns, merged cells, filtering, sorting, searching, conditional formatting, and comments.
Supports data analysis features including pivot tables, text-to-columns, matrix operations, and 385 built-in calculation functions.
Supports one-click screenshots, copying data as JSON, collaborative editing, and copying and pasting data between Excel and Luckysheet.
Supports viewing on mobile devices.
Development Mode
# Environment
1 | Node.js Version >= 6 |
# Installation
1 2 | npm installnpm install gulp -g |
# Development
1 | npm run dev |
# Build
1 | npm run build |
Usage Instructions
Step 1
After running npm run build, copy all files in the dist folder to your project directory.
Step 2
Add the Dependency
1 2 3 4 5 | <link rel="stylesheet" href="plugins/css/pluginsCss.min.css"><link rel="stylesheet" href="plugins/plugins.min.css"><link rel="stylesheet" href="css/main.min.css"><script src="plugins/js/plugin.min.js"></script><script src="main.min.js"></script> |
Step 3
Specify a spreadsheet container.
1 | <div id="luckysheet" style="margin:0px;padding:0px;position:absolute;width:100%;height:100%;left: 0px;top: 0px;"></div> |
Step 4
Create a spreadsheet.
1 2 3 4 5 6 7 8 9 | <script> $(function () { // Configuration options var options = { container: 'luckysheet' //luckysheet is the container ID } luckysheet.create(options) })</script> |
Overall Structure
Type
The data format of a complete Luckysheet spreadsheet file is called luckysheetfile. A spreadsheet file contains multiple sheet files, corresponding to sheet0, sheet1, etc. in Excel.
The following is an example of a Luckysheet file containing 3 sheets: luckysheetfile = [ {sheet1 settings}, {sheet2 settings}, {sheet3 settings} ], equivalent to 3 sheets in an Excel workbook.

The following is an example of a single sheet in the file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | luckysheetfile[0] = {"name": "Supermarket Sales","color": "","chart": [],"status": 0,"order": 0,"celldata": [],"row":90,"column":100,"index": 0,"visibledatarow": [],"visibledatacolumn": [],"rowsplit": [],"ch_width": 4629,"rh_height": 1681,"luckysheet_select_save": {},"luckysheet_selection_range": {},"scrollLeft": 0,"scrollTop": 0,"load": "1","config": {"columlen": {},"rowhidden": {}},"pivotTable": {},"isPivotTable": true, "calcChain": [], "filter":{key1:value1, key2:value2}, "filter_select": {}} |
How to View
In the Chrome console, run luckysheet.getluckysheetfile() to view the complete configuration [{shee1}, {sheet2}, {sheet3}].