1

I want to add multiple rows at a time to table on Excel. Right now we are adding using for loop.

 await Excel.run(async (ctx: Excel.RequestContext) => {
        sheet = ctx.workbook.worksheets.getItem('sheetName');
        table = ctx.workbook.tables.getItem('tableName');
        await ctx.sync();

        for (let i: number = 0; i < addRowCount; i++) {
          table.rows.add();
        }
}

Is there API on Office js which allow to insert multiple rows at a time?. I was exploring Excel.Range class. but did not find any helpful one.

Amir
  • 1,855
  • 3
  • 24
  • 40

1 Answers1

1

Yes. Beginning with Excel.js 1.4, you can use the same add method to add multiple rows. See TableRowCollection.add.

Rick Kirkham
  • 9,038
  • 1
  • 14
  • 32