Using google sheets as a database for an external application

4 views
Skip to first unread message

Poppy Williams

unread,
Aug 30, 2025, 8:07:05 AM (10 days ago) Aug 30
to Google Sheets Community
Hi all, I'm very new here. Excited to see how I can help people and how they can help me.
I'm currently experimenting with using google sheets as an external database. My intentions are pretty simple. I have a load of data in a games application that I want to save in google sheets. Now one time saving is not the problem. That works, slow, but it works.
However when I want to send an update to my 'database', I either want to overwrite my existing data, or clear the contents of a range and write all the updated info in the emptied cells. And that doesn't work. Whatever I try, my data keeps getting appended to that last entered data. Is there a way to overcome this? 

I use the function underneath. Any help is highly appreciated. You may have guessed, I'm a novice in this area ;-)

function doGet(e) {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");

  // Haal data op vanaf A2 tot de laatste rij met data
  var lastRow = sheet.getLastRow();
  var dataRange = sheet.getRange("A2:N");
  var data = dataRange.getValues();

  var output = [];

  for (var i = 0; i < data.length; i++) {
    output.push({
      nr: data[i][0],
      name: data[i][1],
      hcp: data[i][2],
      date: data[i][3],
      R1: data[i][4],
      R2: data[i][5],
      R3: data[i][6],
      R4: data[i][7],
      R5: data[i][8],
      R6: data[i][9],
      R7: data[i][10],
      R8: data[i][11],
      R9: data[i][12],
      R10: data[i][13]
    });
  }

  return ContentService.createTextOutput("Success Up");
}

Reply all
Reply to author
Forward
0 new messages