Skip to content

ImportFile

Options

importFile

Can be set at: grid

Source code

importFile.importFile : object

The importFile option configures the ImportFile plugin.

You can set the importFile option to one of the following:

SettingDescription
undefinedUse the ImportFile plugin with the default configuration
trueUse the ImportFile plugin with the default configuration
falseDisable the ImportFile plugin
An objectEnable the ImportFile plugin and modify the plugin options

If you set the importFile option to an object, you can configure the following options:

OptionTypeDefaultDescription
enginesObjectA map of format keys to engine modules. Pass { xlsx: ExcelJS } to enable XLSX import. The key is the file format the engine reads; the import looks up engines[format].

false disables the plugin. true or an object enables it; an engine is still needed to import a file.

Read more:

Default: undefined
Since: 19.0.0
Example

import ExcelJS from 'exceljs';
importFile: {
engines: { xlsx: ExcelJS },
},

Members

PLUGIN_KEY

Source code

ImportFile.PLUGIN_KEY

Returns the plugin key used to identify this plugin in Handsontable settings.

PLUGIN_PRIORITY

Source code

ImportFile.PLUGIN_PRIORITY

Returns the priority order used to determine the order in which plugins are initialized.

SETTING_KEYS

Source code

ImportFile.SETTING_KEYS

Returns the setting keys that trigger a plugin update when changed via updateSettings.

Methods

destroy

Source code

importFile.destroy()

Removes the instance-owned stylesheet installed by a previous import before the base plugin teardown runs.

disablePlugin

Source code

importFile.disablePlugin()

Disables the plugin functionality for this Handsontable instance and removes the stylesheet a previous import installed, so htImported-* rules stop painting cells whose meta still carries the class.

enablePlugin

Source code

importFile.enablePlugin()

Enables the plugin functionality for this Handsontable instance.

importFromArrayBuffer

Source code

importFile.importFromArrayBuffer()

Reads a workbook from an ArrayBuffer and maps it into an ImportResult. Applies the result to the grid unless options.apply is false or a beforeImport hook returns false.

importFromBlob

Source code

importFile.importFromBlob()

Reads a workbook from a Blob (e.g. a File from an <input type="file">) and maps it into an ImportResult. Applies the result to the grid unless options.apply is false or a beforeImport hook returns false.

isEnabled

Source code

importFile.isEnabled()

Enabled unless the importFile option is false; the engine decides what it can import.

supportsImportFormat

Source code

importFile.supportsImportFormat()

Returns true when an engine is configured for the format and that engine can read it. ExcelJS, the only engine supported today, reads xlsx only.