ImportFile
Options
importFile
Can be set at: grid
importFile.importFile : object
The importFile option configures the ImportFile plugin.
You can set the importFile option to one of the following:
| Setting | Description |
|---|---|
undefined | Use the ImportFile plugin with the default configuration |
true | Use the ImportFile plugin with the default configuration |
false | Disable the ImportFile plugin |
| An object | Enable the ImportFile plugin and modify the plugin options |
If you set the importFile option to an object, you can configure the following options:
| Option | Type | Default | Description |
|---|---|---|---|
engines | Object | – | A 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
ImportFile.PLUGIN_KEY
Returns the plugin key used to identify this plugin in Handsontable settings.
PLUGIN_PRIORITY
ImportFile.PLUGIN_PRIORITY
Returns the priority order used to determine the order in which plugins are initialized.
SETTING_KEYS
ImportFile.SETTING_KEYS
Returns the setting keys that trigger a plugin update when changed via updateSettings.
Methods
destroy
importFile.destroy()
Removes the instance-owned stylesheet installed by a previous import before the base plugin teardown runs.
disablePlugin
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
importFile.enablePlugin()
Enables the plugin functionality for this Handsontable instance.
importFromArrayBuffer
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
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
importFile.isEnabled()
Enabled unless the importFile option is false; the engine decides what it can import.
supportsImportFormat
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.