Univer
Univer Sheet
Features
Import & Export

Import & Export

📊 Univer Sheet
🏆

This feature contains closed-source code, allowing any user to use it for free. It also includes an optional business upgrade plan that provides richer features and services.

💻

This feature depends on the Univer backend service. Please make sure you have read the related documentation and completed the deployment before using it.

We provide the ability to import and export Excel files through the server interface. Install this plugin to quickly access the import and export capabilities in Univer.

Currently only .xlsx format is supported.

Installation

pnpm add @univerjs-pro/sheets-exchange-client

Import

import '@univerjs-pro/sheets-exchange-client/lib/index.css';
 
import { UniverSheetsExchangeClientPlugin } from '@univerjs-pro/sheets-exchange-client';

Internationalization

import { LocaleType, Tools } from '@univerjs/core';
import SheetsExchangeClientEnUS from '@univerjs-pro/sheets-exchange-client/locale/en-US';
 
const univer = new Univer({
  theme: defaultTheme,
  locale: LocaleType.EN_US,
  locales: {
    [LocaleType.EN_US]: Tools.deepMerge(
      SheetsExchangeClientEnUS
    ),
  },
});

Register

univer.registerPlugin(UniverSheetsExchangeClientPlugin);

Configuration

If the import/export interface has not changed, you do not need to configure it. If there are changes, you can configure the interface address as follows:

import { IConfigService } from '@univerjs/core'
import { EXCHANGE_UPLOAD_FILE_SERVER_URL_KEY, EXCHANGE_IMPORT_SERVER_URL_KEY, EXCHANGE_EXPORT_SERVER_URL_KEY, EXCHANGE_GET_TASK_SERVER_URL_KEY, EXCHANGE_SIGN_URL_SERVER_URL_KEY } from '@univerjs-pro/sheets-exchange-client';
 
const injector = univer.__getInjector();
const configService = injector.get(IConfigService);
configService.setConfig(EXCHANGE_UPLOAD_FILE_SERVER_URL_KEY, `http://localhost:3010/universer-api/stream/file/upload`);
configService.setConfig(EXCHANGE_IMPORT_SERVER_URL_KEY, `http://localhost:3010/universer-api/exchange/{type}/import`);
configService.setConfig(EXCHANGE_EXPORT_SERVER_URL_KEY, `http://localhost:3010/universer-api/exchange/{type}/export`);
configService.setConfig(EXCHANGE_GET_TASK_SERVER_URL_KEY, `http://localhost:3010/universer-api/exchange/task/{taskID}`);
configService.setConfig(EXCHANGE_SIGN_URL_SERVER_URL_KEY, `http://localhost:3010/universer-api/file/{fileID}/sign-url`);

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