Answer the question
In order to leave comments, you need to log in
How to find difference in multidimensional array (google script)?
Good afternoon. Help please. comparing two multi-dimensional (multi-line) arrays. You need to find values that are in one column of the table, but not in another table.
There are two tables at the input. In the first table, in the first column, a unique code (for mass comparison, we take it), then a set of specific fields. The structure of the second table: the first column is the date of the entry, the second column is a unique code (we compare it with the first table). Those. for comparison, I take the first column of the first table, and the second column of the second table, and look for codes that are not in the second table (that is, I need unique codes from the first table that are not found in the second table). And the code that I compiled does not show me this difference in any way ... What is the error? What is missing in the code?
// Данные для первой таблицы
var sheet = SpreadsheetApp.openById("1CoSKjOmiKqLIU").getSheetByName('contact');
var numRows = sheet.getLastRow();
var dataRange = sheet.getRange(1, 1, numRows, 5)
var data = dataRange.getValues();
// Данные для второй таблицы
var sheetAnswer = SpreadsheetApp.openById("1jjqrpqkG-LdDrVRyXqftJ6NcBts").getSheetByName("Ответы");
var lastRowAnswer = sheetAnswer.getLastRow();
var dataRangeAnswer = sheetAnswer.getRange(1, 1, lastRowAnswer , 2);
var dataAnswer = dataRangeAnswer.getValues();
function sendMail() {
var k = 0
for (var i =0 ; i< dataAnswer.length; i++) {
for (var q = 0; q < data.length; q++){
if (data[q][0] !== dataAnswer[i][1])
{
// В k, пытаюсь вывести не пересекающиеся значения!
k = data[q][0]
}
};
};
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question