3

I have quite a big problem. If I read columns cells with for loop and range(r,c.).getValue() (same for reading with range(r,c,m,1).getValues() ) the values are not read. I got #ERROR!. I am reading cell values that are some as reference from other sheet and other with some if, round and plus/minus calculations.

DataSource

As you maybe see on the figure I have a fixed test value over some columns (number 2, 3, 4, 5) and these are always read OK.

ErrorCodes SourceCode

In the source code I added 3 lines that read fixed entered values (2,3,4,5).

Any suggestion why as I have several scripts with reading cell values but nothing similar happend till now.

Thank you!

Rubén
  • 34,714
  • 9
  • 70
  • 166
Jure Rejc
  • 103
  • 1
  • 7

1 Answers1

0

Regards,

If my understanding if correct, you would like to obtain values from cells that have dynamic values (calculated or referenced).

It might fail if you use range.getValue() since there are no actual value in the cell. You can try to use range.getDisplayValues() instead to get the displayed value. This is documented here.

If you are doing this, your code will be like this :

for(var ii=0; ii < iDNRows; ii++)
{
   i0mik_od_zacetka = sIzracuni.getRange(ii+StartRowData, iStartColumnData).getDisplayValue();
   .
   .
   .
   
}

Or you can do .getDisplayValues() :

values = sIzracuni.getRange(startrow,startcol,rownum,colnum).getDisplayValues();

Do comment if I have misunderstood your question.