Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8174365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:26:23+00:00 2026-06-06T22:26:23+00:00

Quite embarrassing really, but I tested creating a database from a spreadsheet with a

  • 0

Quite embarrassing really, but I tested creating a database from a spreadsheet with a modified script from this example:

function loadDatabaseFromSheet() {
  var sheet = SpreadsheetApp.openById('my_key').getSheetByName('Payroll');
  var data = sheet.getDataRange().getValues();
  data = data.splice(0, 9);                 // **this is where I went wrong**
  var keys = data[0];                       // **this actually corresponds with a blank row**
  var db = ScriptDb.getMyDb();
  for (var row = 1; row < data.length; row++) {
    var rowData = data[row];
    var item = {};
    for (var column = 0; column < keys.length; column++) {
      item[keys[column]] = rowData[column]; // **null values used to name attributes???**
    }
    db.save(item);
  }
}

So the Javascrit noob should have used data.splice(0, 9) rather than data = data.splice(0, 9). I wanted to remove the first nine rows from the array, not retain them.

Anyway, it seems as it stands the database is not repairable or erasable. I can’t retrieve any records; any time I try to invoke .next() or .hasNext() I get a server error thrown, for example with this script from here:

function deleteAll() {
  var db = ScriptDb.getMyDb();
  while (true) {
    var result = db.query({}); // get everything, up to limit
    if (result.getSize() == 0) {
      break;
    }
    while (result.hasNext()) {
      db.remove(result.next());
    }
  }
}

.getSize() does work, but the script returns a server error when it gets to the line with .hasNext(), presumably because of the faulty object. I also tried a batch remove:

function batchRemove() {
  var db = ScriptDb.getMyDb();
  var result = db.query({});
  db.removeBatch(result, false); 
}

And I get:

Cannot find method removeBatch($Proxy799,boolean). (line 114)

By the way, I can successfully save a new record to the database, and retrieve that record with a query, but if the query returns anything else in the database that was created with the flawed script, that’s when I get the failure when I try to work with the resulting objects.

So I understand my error and promise to take more care in the future, but does anyone know how I can “clean out” my database to start again?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:26:27+00:00Added an answer on June 6, 2026 at 10:26 pm

    OK false alarm I guess, I tried again and I’m able to clear the database now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is quite embarrassing ,tried to find the solution by myself but real lack
This is a very basic question...quite embarassing, but here goes: I have a Stopwatch
Quite often see in JavaScript libraries code like this: setTimeout(function() { ... }, 0);
I have been working with jquery for a while so this is quite embarrassing
I have found quite a few questions related to this but I haven't found
Quite experienced but self taught with PHP/MySQL and playing about with Rails. Really love
Quite simply: is there a place such as DeviantArt, but purely for the purpose
Quite embarrassing how much time I spend trying to get to download a zipfile
It is quiet embarrassing but I just don't get it. How should I browse
Quite new to functional languages, but I'm maintaining someone else's code with a lot

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.