Forum Discussion
mdebellis
May 22, 2019Copper Contributor
Inserting multiple rows
I know this is a very basic question but I can't find the answer in the documentation. I often want to insert a bunch of rows at a time. Currently I just do it one at a time but I would like to do so...
- Mar 14, 2023
Perhaps like
function main(workbook: ExcelScript.Workbook) { let tabela1 = workbook.getTable("Tabela1"); // Custom sort on table tabela1 tabela1.getSort().apply([{ key: 1, ascending: false }], false); let selectedSheet = workbook.getActiveWorksheet(); tabela1.getRange().removeDuplicates([0, 1, 3, 4], true); const rows = tabela1.getRowCount() for (let i = rows; i>0; i--) { if (tabela1.getColumn(1).getRange().getValues()[i][0] === '') tabela1.deleteRowsAt(i-1) } }
Twifoo
May 22, 2019Silver Contributor
Select the appropriate number of cells below the cell you want to insert rows. Press Ctrl+Plus sign (+), then press R, and click OK.
mdebellis
May 23, 2019Copper Contributor
Twifoo Sorry, I was being dense. Now I get it. When I select multiple rows it inserts the same number of rows, that's what I needed, thanks for the help.
- Dong_Sheng_LiuJan 10, 2022Copper Contributor
I didn't get it. The method mentioned above just inserts one row below each of the rows I have selected respectively. I'm wondering how to insert multiple rows only below exactly the row I have selected.mdebellis
- mdebellisJan 12, 2022Copper ContributorHere is how I do it, in a bit more detail. (There are probably other ways to do it)
1) Select the row that you want to add rows above or below
2) Use control left click to select the number of rows you want to add. For example, suppose you have a spreadsheet with 10 rows and you want to add 5 more rows after row 5. Select row 5 then select rows 6-10.
3) Right click (making sure rows 5-10 are still selected) and then select Insert. It should insert 5 new rows below row 5.- Dong_Sheng_LiuJan 14, 2022Copper ContributorI'm using Microsoft Office Professional Plus 2019. I think it might behave different from your excel due to version difference.
- TwifooMay 24, 2019Silver ContributorYou’re welcome.