GAS AI BuilderApps Script Assistant Sign in

Return data the page can read

Apps Script recipes › Web app

Turns dates into text and drops values the page can't receive, so a result never arrives as null.

File Code.gs

/** A copy of `value` the page can receive: every Date becomes ISO text (JSON does that), undefined fields are dropped. */
function plain_(value) {
  return value === undefined ? null : JSON.parse(JSON.stringify(value));
}

function getDashboard() {
  const rows = SpreadsheetApp.openById(SHEET_ID).getSheetByName('Orders').getDataRange().getValues();
  return plain_({ updated: new Date(), count: rows.length - 1, last: rows[rows.length - 1] });
}

Good to know

Let the AI put it in your appGAS AI Builder knows every recipe here. Describe your app and it uses this code where it fits, in a Google Apps Script project in your own Drive.

Use it in a project

More in Web app

Who is using the app, and their roleReads the visitor's email and looks up their role in a Users tab; server functions check it before doing anything.doGet with pages split into filesindex.html pulls in css/app.html and js/app.html with include(); works on phones and inside an iframe.Call the server from the page with async/awaitA small helper turns google.script.run into a promise, with errors shown instead of lost.Upload a file from the page to DriveThe page reads the chosen file as base64 and sends it; the server saves it in a folder and returns its link.