Migrate From Luckysheet to Univer
Compared with Luckysheet, our newly designed Univer has made great improvements in terms of architecture, data structure and API, so Luckysheet can no longer be migrated 1:1 to Univer.
However, basic data types or APIs can be found in Univer. In view of this, if you still want to migrate Luckysheet data to Univer, you can do some targeted adaptation work according to your needs.
Here is a migration guide for everyone.
Analysis
Configuration
The core work of the conversion is to adapt the workbook configuration, worksheet configuration and cell information. You can refer to the Univer interface and Luckysheet data structure.
Univer | Luckysheet | |
---|---|---|
Workbook configuration | IWorkbookData | Overall Configuration |
Worksheet configuration | IWorksheetData | Sheet Configuration |
Cell | ICellData | Cell Attributes |
Plugin
Luckysheet is initialized through a JSON configuration, while Univer is split, the enhanced functions are implemented with plugins, so some functions need to be dispersed into plugin configurations, such as
Univer | Luckysheet | |
---|---|---|
Number Format | numfmt, Configure via Cell Style | Cell format: cell.ct |
Floating Images | floating images | image |
Find & Replace | find replace | - |
Filter | filter | filter |
Sort | sort | filter (Included in filter) |
Pivot Table | pivot table | pivotTable |
Data Validation | data validation | dataverification |
Conditional Formatting | conditional formatting | luckysheet_conditionformat_save |
Comment / Annotation | thread comment | Cell Comments: cell.ps |
Print plugin | ||
Import & Export | import export | Luckyexcel import & export, Or community solutions |
Collaborative Editing | collaboration | LuckysheetServer |
API
For the API part, Luckysheet API is uniformly mounted on window.luckysheet
, there are two ways to use Univer API
- Call the encapsulated Facade API
- Use Univer’s dependency injection system to inject the plugin’s service capabilities into the current Class. Refer to our Plugin Tutorial to easily access the Univer dependency injection system
Summary
For some commonly used basic data, you can refer to Migrate Luckysheet Demo and customize it according to project requirements.
If Univer’s existing functions do not meet your needs, you can also develop your own plugin for adaptation.
FAQ
How to migrate the transformExcelTolucky
method of Luckyexcel?
The transformExcelTolucky
method is provided in Luckyexcel, which can convert Excel files into JSON data. In the corresponding Univer, the importXLSXToSnapshot
method of Facade API can be used to achieve this.
If you need to convert an online Excel file, Luckyexcel provides the transformExcelToLuckyByUrl
method. Univer does not directly provide a method to convert online Excel files, but you can download the online Excel file to the local computer through the browser’s fetch API, and then call the importXLSXToSnapshot
method to achieve this. Refer to How to Open or Edit an Excel File from a URL.