excel-column-mapper
v1.2.1
Published
Step 1: Installation of the Library Open your command line interface and execute the following command:
Downloads
81
Readme
ExcelColumnMapper - Created By Sagar Pandey from ACS Infotech Pvt.Ltd.
Step 1: Installation of the Library Open your command line interface and execute the following command:
"npm install excel-column-mapper"
This will install the required library for mapping Excel columns.
Step 2: Import in Module Import the library into your module where you intend to use it. import { ExcelColumnMapperModule } from 'excel-column-mapper'; also add it in imports section of your module.
Step 3:
In your HTML file, use the following syntax to incorporate the Excel Column Mapper component: Make sure to adjust the properties accordingly.
<app-excel-mapper class="" [MapColumn]="mapColumn" [MainHeading]="mainHeading" [showHeaderValues]="ShowHeaderValues" [showDataTable] = "ShowTable" [btnTitle] = "BtnTitle" [columnHeaders]="columnHeaders" [selectSheetHeading] = "SelectSheetHeading" [CHUNK_SIZE]="chunkSize" (OutputJSON)="handleOutputJSON
• mapColumn: Specify the mapping of Excel columns. For example, 'EmpCode:Product Code' maps 'EmpCode' column to 'Product Code'. • MainHeading: Set the main heading for the component. • showHeaderValues: Boolean value to determine whether to display header values. • showDataTable: Boolean value to determine whether to display the data table. • btnTitle: Set the title for the upload button. • columnHeaders: Provide an array of column headers. • (OutputJSON): Capture the output JSON data by binding to this event. • selectSheetHeading: There is DropDown heading to allow user to select the sheetname you can dynamically change it's heading through this. • CHUNK_SIZE: This is to dynamically set the size of max chunks of data If there is so much data in excel it will be seprated with 100 (size it as per your requirement) rows in each json and return the data in an array form with all these chunks.
Step 4: Declaring Properties :
Declare the necessary properties in your component and assign values according to your requirements.
Here's an example:
columnHeaders: string[] = ['EmpCode', 'EmpName']; mapColumn: string[] = ['EmpCode:Product Code','EmpName:Customer Name']; mainHeading: string = "Map Excel Column"; ShowHeaderValues: boolean = true; ShowTable: boolean = true; BtnTitle: string="Upload Data"; SelectSheetHeading:string='Select Sheets'; chunkSize: number=100;
That's it you are good to go.