How to set the values of a specific range, A94:A244

Samantha Gomes 40 Reputation points
2023-08-18T18:02:59.4133333+00:00

I am trying to automate an End of Day report, one of the things I want it to do is take information from a Jira CSV, like bug numbers, summaries, ect, and put all that in a predefined area in the EoD sheet.
However, whenever I try to have my script set the values of the cells in A94:A244 I always get this error:

Line 16: Range setValues: The number of rows or columns in the input array doesn't match the size or dimensions of the range.

Yet, if I change the range being set to A1:A, it sets the cell values correctly.
Could I please get some help understanding what I am doing wrong?

This is my script

function main(workbook: ExcelScript.Workbook) {
	let jiraSheet = workbook.getWorksheet("Jira");
	let outputSheet = workbook.getWorksheet("EoD");

	let outputRange = [] = [];


	let bugSourceRange = jiraSheet.getRange("B2:B152").getValues();
	for (let i = 0; i < bugSourceRange.length; i++) {
		let bugString = bugSourceRange[i][0] as string;
		let prefix = bugString.substring(0, 3);
		if (prefix == "X") {
			outputRange.push(bugSourceRange[i]);
		}
	}
	outputSheet.getRange("A94:A244" + outputRange.length).setValues(outputRange);
}
Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
2,176 questions
JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
1,058 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
4,344 questions
{count} votes

Accepted answer
  1. Viorel 121.3K Reputation points
    2023-08-18T18:11:31.3766667+00:00

    Maybe you should write this:

    
    outputSheet.getRange("A94:A" + (94 + outputRange.length - 1)).setValues(outputRange);
    
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.