Created
August 5, 2023 12:48
-
-
Save dashaluna/a8b0269e99401550a738cd82c3359623 to your computer and use it in GitHub Desktop.
GSheet Script for daily valuation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function plotDailyValuation() { | |
//read the counter (#) in cell A1 of History, number in cell is the row of column to input data | |
var counter = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("History").getRange("D2"); | |
// record DATE in cell A# | |
var date = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("History").getRange("A"+counter.getValue()); | |
date.setValue(new Date(new Date().getFullYear(),new Date().getMonth(), new Date().getDate())); | |
//read portfolio value in "Portfolio Sheet" | |
var portfolioValue = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Portfolio").getRange("H18"); | |
var value = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("History").getRange("B"+counter.getValue()); | |
value.setValue(portfolioValue.getValue()); | |
//+1 to the counter in cell A1 | |
counter.setValue(counter.getValue() + 1); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment