There is a script that imports data from one Google table to another.
The problem is that both documents must be identical in the number of lines. Since the first document is dynamic, the second just has to be corrected by hand to the required number of lines (as in the first document).
Tell me how to get rid of this addiction? To import a range, regardless of how many lines are in the document that receives this data. And how to import not only in cell A1, but, for example, in cell B2? C3? and so on ... Sample data
function onOpen2(e) { // исходный документ var sss = SpreadsheetApp.openById('Ключ'); // исходный лист var ss = sss.getSheetByName('Лист'); // Получить диапазон данных var SRange = ss.getRange('A:D'); // Скопировать в ячейку. В данном случае (A1) var A1Range = SRange.getA1Notation(); // получить значения данных в диапазоне var SData = SRange.getValues(); // Целевая таблица. Куда выгружаем var tss = SpreadsheetApp.openById('Ключ'); // Целевой лист. Куда импортируем var ts = tss.getSheetByName('лист'); // Очищение диапазона перед копированием. ts.getRange('A1:D').clearContent(); // Скопировать в ячейку. В данном случае (A1) ts.getRange(A1Range).setValues(SData); }