In my spread sheet, there are 3 tabs, let's call them A,B and C.
- Tab A has user input data
- Tab B picks up that data (get.range and set.formula) and time stamps it (daily interval) with rows appended (script) . This data is stored in columns B to F.
- Tab C has charts based on this data (columns B to F), so that real time trend info is available
To ensure that users don't go back to previous data and change it (in Tab A) ,the script uses this for Tab B:
var ulock = sh.getRange("B:F"); ulock.copyTo(ulock,{contentsOnly:true});
This works fine but with a drawback- if a user makes a mistake in data entry and corrects it, this correction is not updated in Tab B and Tab C because of the above copy command.
How do I ensure that the last row of data in Tab B stays current (changes in Tab A are reflected) and only on trigger firing the last row loses it formulae and retains only values? Something like range B:F to exclude the last row? or any other way?
Edit: I have last row variable definedIn the script, so maybe looping copy command from Row1 to last row - 1 is an option? Not sure how to do that