GuidesUniver SheetsTutorialsMigrate From Luckysheet

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.

UniverLuckysheet
Workbook configurationIWorkbookDataOverall Configuration
Worksheet configurationIWorksheetDataSheet Configuration
CellICellDataCell 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

UniverLuckysheet
Number Formatnumfmt, Configure via Cell StyleCell format: cell.ct
Floating Imagesfloating imagesimage
Find & Replacefind replace-
Filterfilterfilter
Sortsortfilter (Included in filter)
Pivot Tablepivot tablepivotTable
Data Validationdata validationdataverification
Conditional Formattingconditional formattingluckysheet_conditionformat_save
Comment / Annotationthread commentCell Comments: cell.ps
PrintprintPrint plugin
Import & Exportimport exportLuckyexcel import & export, Or community solutions
Collaborative EditingcollaborationLuckysheetServer

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.