How to setup 2-way data sync for formulas like FILTER(), QUERY(), and IMPORTRANGE() on Google Sheets.
Important notes:
* Create a unique key for each row so the script can find the right row on the database
* This simple script assumes identical headers in the database and sub sheets
Sheet to copy:
[ Ссылка ]
Script:
function onEdit(e){
let ss = e.source.getActiveSheet();
let name = ss.getName();
if (name == "Database" || e.range.rowStart == 1) return;
e.range.clearContent();
let db = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Database");
let r = ss.getRange(e.range.rowStart,1).getValue();
db.getRange(r+1,e.range.columnStart).setValue(e.value);
}
I'm Spencer Farris, a Google Product Expert for Sheets and Scripts. [ Ссылка ]
![](https://i.ytimg.com/vi/bYzNtPm_XGs/maxresdefault.jpg)