How to restrict the rows and columns count for imported excel file in JavaScript spreadsheet?
This article explains how to restrict the rows and columns count for imported excel files in a JavaScript spreadsheet. It is achievable by configuring the scrollSettings: { isFinite: true } in the initial load and setting the used range of the loaded file in the openComplete event.It restricts the row and columns of the unused rows while importing the excel file into a spreadsheet.
[HTML]
<div id="spreadsheet"></div>
[TS]
//Initialize the Spreadsheet component. let spreadsheet: Spreadsheet = new Spreadsheet({ scrollSettings: { isFinite: true }, openUrl: 'https://ej2services.syncfusion.com/production/web-services/api/spreadsheet/open', saveUrl: 'https://ej2services.syncfusion.com/production/web-services/api/spreadsheet/save', openComplete: (args: Object) => { let sheet = spreadsheet.getActiveSheet(); // You need to set the row count and column count based on the used range indexes in the sheet model. let rowCnt = sheet.usedRange.rowIndex; let colCnt = sheet.usedRange.colIndex; sheet.rowCount = rowCnt + 1; sheet.colCount = colCnt + 1; }, }); //Render initialized Spreadsheet component. spreadsheet.appendTo('#spreadsheet');
Refer to the working sample for additional details and implementation: Sample
Documentation:
https://ej2.syncfusion.com/documentation/spreadsheet/scrolling/
Conclusion
We hope you enjoyed learning about how to restrict rows and
columns count for imported excel file in JavaScript Spreadsheet.
You can refer to our JavaScript
Spreadsheet feature tour page to know about its other groundbreaking
feature representations and documentation,
and how to quickly get started for configuration specifications. You can also
explore our JavaScript
Spreadsheet example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, BoldDesk Support, or feedback portal. We are always happy to assist you!