V
V
Vladimir Zuev2020-06-30 11:50:50
Google Apps Script
Vladimir Zuev, 2020-06-30 11:50:50

Why doesn't indexof see the values ​​in the value set from the column?

Hello.
I want to avoid repetitions when filling the table. To do this, you need to compare the incoming values ​​with the values ​​in the column. But indexof and lastindexof do not see values ​​taken from a column of values ​​in a set of values. Although they are there.
Code to get values ​​from a column.

var ran = sheet1.getRange(2, 3, lr-1,  1);
        var values = ran.getValues();

Codes for getting the first and last occurrence of a value
var firstIndex = values.indexOf(IntDocNumber);
var lastIndex = values.lastIndexOf(IntDocNumber);

Repeats of values ​​in the table on the screen
5efafc2c6c9b4910450817.png
How to search for repeats in the table? Also what it is necessary to make that indexof and lastindexof saw values ​​in an array received from a column of the table?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Noir, 2020-06-30
@vladd56

https://developers.google.com/apps-script/referenc...
removeDuplicates()
you can finally just run the entire sheet through this method

M
mityayka1, 2020-07-19
@mityayka1

You get a two dimensional array. The array you need is values[0]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question