Forum Discussion
MadPrince
Oct 05, 2023Copper Contributor
Excel Script, input data in blank column/ rows
I have this problem in my excel script formula. It is working fine.
The only problem is that I need to input starting row... And if for example there is data or the column/row is not empty, it will overwrite the existing data.
Here is the excel script.
5 Replies
- SergeiBaklanDiamond Contributor
- MadPrinceCopper Contributor
This did the trick.. thank you.
- SergeiBaklanDiamond Contributor
Or
function main(workbook: ExcelScript.Workbook) { const arrayvar = workbook .getTable("Table1") .getRangeBetweenHeaderAndTotal() .getValues() const sheet = workbook.getActiveWorksheet() let rangeToFill: ExcelScript.Range = sheet .getCell( sheet .getUsedRange() .getLastRow() .getRowIndex(), 0) .getResizedRange(0, arrayvar[0].length - 1) arrayvar.map(x => { rangeToFill = rangeToFill.getRowsBelow(1); rangeToFill.setValues(Array.of(x)) } ) }
- JKPieterseSilver Contributor
MadPrince Not the prettiest solution, but perhaps something like this?
https://jkp-ads.com/articles/excel-office-script-examples.asp#Prompting_for_user_input