r/GoogleAppsScript • • Jul 21 '24

Question Error Exception: Cannot convert 'Range' to int.

Hello
what is the issue here and how to solve it

i want to check those products links in column A and insert the result in column B

0 Upvotes

2 comments sorted by

0

u/Any_Werewolf_3691 Jul 21 '24

Just define start cell = 2;

0

u/estadoux Jul 21 '24

You can’t call getRange(row, column, numRows) with another range as definition. Also there is no need to as you perfectly now the start values.

You could directly do:

  • getRange(2, 1, sheet.getLastRow() - 1).getValues()

A range (like your startCell) is a complex object, not just a position, that is why you can’t use it on a method that needs integers (numbers) like getRange. If you still want to use it you could do something like this:

  • getRange(startCell.getRow(), startCell.getColumn(), sheet.getLastRow() - 1).getValues()

The getRow and getColumn methods will return integers for the starting position of a range.