I made a script that copies the last sheet of a spreadsheet and assigns it the current date as the name, i.e. "July 28, 2019".
Now, there are dozens of formulas in those sheets that reference the date before it for calculationsand I need them to auto-update as well as changing all the references by hand is too tedious of a process. There are over 80 of them.
In Excel, I've been able to solve this issue by adding a function that replaced every occurrence of the sheet from two days ago to the sheet from once day ago simply by comparing names in the given data ranges via the Replace method in VBA. Now I need to do the same in google script, but I can't find a similar method in the Google Script documentation.
Does anyone know how to go about doing this? Googling the issue didn't turn up much help. I've included the code I use in VBA below for clarification purposes.
Public Sub FormulaUpdate()
to_replace = ActiveWorkbook.Sheets(ActiveWorkbook.Sheets.count - 2).name
replace_val = ActiveWorkbook.Sheets(ActiveWorkbook.Sheets.count - 1).name
range("D2:D100").Replace What:=to_replace, Replacement:=replace_val, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
range("G45:G54").Replace What:=to_replace, Replacement:=replace_val, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub