Forum Discussion
chrisparkinsonarthouse
Jul 27, 2022Copper Contributor
Excel Online Script to add row with formula
Hi All, Ive got a workbook saved to a SharePoint folder. In the workbook is a script. See below. Its the part in bold i need help with. Basically the script needs to add a header to the...
- Jul 28, 2022You simply add this line of code immediately below that last one:
selectedSheet.getCell(theRow, 1).setFormula("=ROW()");
JKPieterse
Jul 28, 2022Silver Contributor
Not sure I understand. How would you manually determine where to put that number 99?
- chrisparkinsonarthouseJul 28, 2022Copper Contributor
- JKPieterseJul 28, 2022Silver Contributor
chrisparkinsonarthouse Is this what you intended?
function main(workbook: ExcelScript.Workbook) { let selectedSheet = workbook.getActiveWorksheet(); let theRow = selectedSheet.getUsedRange().getRowCount(); selectedSheet.getCell(theRow,0).setValue(99); }
- chrisparkinsonarthouseJul 28, 2022Copper Contributor
JKPieterse Hi,
Amazing, so the script adds 99 to column A at the bottom of the row. Which is great.
Now i need in Column B same row to be the formula =ROW()
.
Is this possible?