jnjustice
jnjustice

Reputation: 83

Google Form get Google Sheets Value

I've got a Google Form to enter deposits and withdrawals into a Google Sheet and then the ending balance is calculated so the user can balance their check book.

I'm trying to get the most recent balance to display on the Google Form by finding the last row with a balance that is in the 'Ending Balance' column.

It seems a script may be easiest but nothing seems to so what I need. Any advice or direction is appreciated.

Here's the sheet I have set up, it's connected to my form with the headers in row 2. Google Sheet Image

Upvotes: 1

Views: 2508

Answers (1)

ziganotschka
ziganotschka

Reputation: 26796

You can

  • create a bound script attached to your destination spreadsheet
  • set up a installable trigger onFormSubmit that will fire every time a new form is submitted
  • access the newest form submission data with getLastRow()
  • Retrieve the values in column 11 (which contains your Ending balance)

Sample script:

function getMyBalance(){
  var sheet=SpreadsheetApp.getActive().getActiveSheet();
  var row=sheet.getLastRow();
  var column=11;
  var balance=sheet.getRange(row, column).getValue();
  Logger.log(balance);
}

Upvotes: 1

Related Questions