@flatfile/plugin-xlsx-extractor
When embedding Flatfile, this plugin should be deployed in a server-side listener. Learn more
Parameters
In Excel, you could have formatting on a text cell (i.e. date formatting). By default, Flatfile will just take the formatted text versus the raw values. Set this value to true to take the raw values and disregard how it’s displayed in Excel.
In Excel, you could have rounding or formatting on a number cell to only display say 2 decimal places. By default, Flatfile will just take the displayed decimal places versus the raw numbers. Set this value to true to take the raw numbers and disregard how it’s displayed in Excel.
The chunkSize
parameter allows you to specify the quantity of records to in
each chunk.
The parallel
parameter allows you to specify the number of chunks to process
in parallel.
API Calls
api.files.download
api.files.get
api.files.update
api.jobs.ack
api.jobs.complete
api.jobs.create
api.jobs.fail
api.jobs.update
api.records.insert
api.workbooks.create
Imported NPM Packages
@flatfile/api@1.4.9+
@flatfile/hooks@1.3.0+
@flatfile/listener@0.3.15
@flatfile/util-extractor@0.3.0
provides utility functions for extracting and parsing data from various file formats and sources, streamlining data import processes.remeda
offers a set of utility functions for functional programming and data manipulation in JavaScript, providing a convenient way to work with arrays and objects.xlsx
allows for reading, writing, and manipulating Microsoft Excel files in JavaScript applications.
Usage
Listen for an Excel file (all extensions supported) to be uploaded to Flatfile. The platform will then extract the file automatically. Once complete, the file will be ready for import in the Files area.
npm i @flatfile/plugin-xlsx-extractor
import { ExcelExtractor } from "@flatfile/plugin-xlsx-extractor";
listener.use(ExcelExtractor());
Full Example
In this example, the ExcelExtractor
is initialized with optional options, and then registered as middleware with the Flatfile listener. When an Excel file is uploaded, the plugin will extract the structured data and process it using the extractor’s parser.
import { ExcelExtractor } from "@flatfile/xlsx-extractor";
export default async function (listener) {
// Define optional options for the extractor
const options = {
raw: true,
rawNumbers: true,
};
// Initialize the Excel extractor
const excelExtractor = ExcelExtractor(options);
// Register the extractor as a middleware for the Flatfile listener
listener.use(excelExtractor);
// When an Excel file is uploaded, the data will be extracted and processed using the extractor's parser.
}