Univer
Univer Sheet
Tutorials
Migrate From Luckysheet

Migrate From Luckysheet to Univer

📊 Univer Sheet

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 (opens in a new tab)
Worksheet configurationIWorksheetDataSheet Configuration (opens in a new tab)
CellICellDataCell Attributes (opens in a new tab)

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 (opens in a new tab)
Floating Imagesfloating imagesimage (opens in a new tab)
Find & Replacefind replace-
Filterfilterfilter (opens in a new tab)
Sortsortfilter (opens in a new tab) (Included in filter)
Pivot Tablepivot tablepivotTable (opens in a new tab)
Data Validationdata validationdataverification (opens in a new tab)
Conditional Formattingconditional formattingluckysheet_conditionformat_save (opens in a new tab)
Comment / Annotationthread commentCell Comments: cell.ps (opens in a new tab)
PrintprintPrint plugin (opens in a new tab)
Import & Exportimport exportLuckyexcel import (opens in a new tab) & export (opens in a new tab), Or community solutions (opens in a new tab)
Collaborative EditingcollaborationLuckysheetServer (opens in a new tab)

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.


Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.