I am not a big fan of some of the Stock Broker’s GUI, so I am attempting at tracking some of my assets on a Google Sheet.
How can I create Manual (click a button) or Automatic triggers, based off of a certain date, to edit a cell's value or add a new entry into a new cell?
Example Triggers:
Sample Sudo Logic:
Since you won't have the spreadsheet that contains the cell information, any sample template (with comments) would be highly appreciated.
After much trial and error, I was able to create a manual button to update and insert a new row into a sheet.
Example:
Goal is to copy/save the values of Row 2, create a new row underneath, and place the values into the newly created Row 3 without modifying any other values below.
Insert->Drawing->Shapes
Draw a Box, label it as "Update".
Tools->Script Editor
Paste/Save:
function updateInfo()
{
var date = Utilities.formatDate(new Date(), "GMT", "MM/dd/yyyy");
var ss = SpreadsheetApp.getActiveSpreadsheet();
var stats_sheet = ss.getSheets()[1];
stats_sheet.insertRowBefore(3);
var todays_cells = SpreadsheetApp.getActiveSheet().getRange("A2:D2").getValues();
var update_todays_cells = stats_sheet.getRange("A3:D3");
update_todays_cells.setValues(todays_cells);
}
Right-Click the Box, click the 3 dots, assign to script->"updateInfo" (without the quotes)