Skip to content
Advertisement

Query & Timestamp Combined Script Not Working – Debug doesn’t show issue(?)

I am attempting to run a script that combines adding a timestamp upon edit to individual sheets, and also to place a query to create a master sheet of info from all sheets – both upon edit.

Here’s the script I have:

JavaScript

I’ve tried moving things around, but haven’t been able to locate where the issue is.

Here’s a sample doc

The sheets frequently change, with more being added. I’m looking to lessen the amount of formulas / loading time with this, so any ideas/help welcome!

Advertisement

Answer

I have made some changes to your original script so that it doesn’t run without any errors and so that both functions work accordingly. To sum up these are the changed I did to get your funcion to work successfully:

  • Passed the sheet variable to editTimestamp as you were using it without passing it as a function argument (and thus it was returning a no reference error).
  • In updateMasterSheetRow changed masterSheet to masterSheetName as this is the string you want to be checking and you already had defined this varaible in the function.
  • Checked if the sheet matched with the masterSheet name instead of using regex exec as it was of easier implementation and less prone to regular expression errors.
  • Changed the formula.cell as this does not exist and set it to the right cell you want to set the formula to instead.

I have tested editTimestamp and it worked perfectly. However, updateMasterSheetRow worked but did not achieve your purpose as you will need to edit your formulaText to pull the right information from whichever sheet you want (currently it simply pulls empty information from the master sheet at the end of the sheet B224:U225).

Below is your script with the modifications I implemented to solve your issues:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement