Total Rows/Columns Dynamically Adjusting

Posted by: brian on 9 October 2020, 10:20 am EST

  • Posted 9 October 2020, 10:20 am EST

    In MS Excel, rows/columns will continuously generate as the user scrolls to the side/down. We would like to have SpreadJS behave more similarly to this, within reason. Are there any guidelines on practical limitations of row/column numbers or suggested ways to achieve this behavior?

    Thanks for your help!
  • Replied 11 October 2020, 11:29 pm EST

    Hi Brian,

    You may use the TopRowChanged and LeftColumnChanged Events for the required functionality. Please refer to the following code snippet and the attached sample that demonstrates the same.

    sheet.bind(GC.Spread.Sheets.Events.TopRowChanged, (e, args) => {
    let lastRow = args.sheet.getRowCount();
    let viewportLastRow = args.sheet.getViewportBottomRow(1);
    if (viewportLastRow + 10 > lastRow) {
    args.sheet.addRows(lastRow - 1, 15);
    sheet.bind(GC.Spread.Sheets.Events.LeftColumnChanged, (e, args) => {
    let lastCol = args.sheet.getColumnCount();
    let viewportLastCol = args.sheet.getViewportRightColumn(1);
    if (viewportLastCol + 10 > lastCol) {
    args.sheet.addColumns(lastCol - 1, 15);


    API references



  • Replied 12 October 2020, 8:46 am EST

    That's very helpful, thank you. Are there any recommendations as far as setting a maximum number of rows or columns? I.e. any known performance limitations?
  • Replied 13 October 2020, 3:55 pm EST

    Hi Brian,

    Glad to know the issue has been resolved. There is no limit for adding the rows but being a purely client-side, it is limited by the machine capabilities, a machine with a better processor and more free memory would definitely perform better in comparison with a machine with limited memory.

  • Replied 2 December 2020, 1:29 am EST

    Hi Avinash,

    That's useful thanks. Does this also apply to the number of sheets - i.e. there's no hard limit, but will naturally impact performance based on the users system? Additionally, do you happen to know what results if a SpreadJS sheet that exceeds Excel's limits (1,048,576 rows by 16,384 columns) is exported to Excel?

  • Replied 2 December 2020, 9:26 pm EST

    Hi Brian,

    Yes, For number sheets also there is no specified limit but it will impact the performance since SJS is purely a client-side application.

    Further, if we export the sheet that exceeds the excel's limit then Excel will ignore the extra rows/columns. It will only import the row till 1,048,576 same happens for column also. Please let me know if you have any further queries regarding this.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels