I have two spreadsheets - one is private, the other is public.
Whenever the public one receives a webhook it adds a new row with some info in it.
Is there a way for the private one to be able to read the public one and run a function when it detects that a new row has been added?
I can obviously IMPORTRANGE(A1:F) from the public sheet into the private, but as far as I know that has technically auto-filled all of columns A-F, meaning it wont detect when a new row is added? (Because technically all rows are already filled?).
CodePudding user response:
Method 1:
About Whenever the public one receives a webhook it adds a new row with some info in it.
, in your situation, if the new row is added by Sheets API, I think that you can detect this using OnChange trigger of the installable trigger. Ref In this case, you can run the function using Google Apps Script executing by OnChange trigger. In this case, you can do something between the public and private Spreadsheets using the script.
Method 2:
If the new row is added by no Sheets API, in this case, in order to check the added new rows, how about using the time-driven trigger? When the time-driven trigger is used, the added new rows can be detected by checking every several minutes using Google Apps Script. By this, when the new rows are added, you can execute the function using Google Apps Script running by the time-driven trigger. In this case, you can do something between the public and private Spreadsheets using the script.
Reference:
CodePudding user response:
yes and no. refresh rate of IMPORTRANGE
is 30 minutes. and there are ways how to make it refreshable every minute or on every change in spreadsheet settings