John
John

Reputation: 21

Get column value in the scriptdb query statement in google apps script with quotes e.g. "Cust Name"

I'm trying to get the value of a column from a ScriptDb database for a column called "Cust Name" - if it was CustName or similar I could do the following:

while(result.hasnext()){ 

  res = result.next();
  var CustName = res.CustName;

}

How you I get the value if the column is called "Cust Name"?

Upvotes: 1

Views: 202

Answers (1)

RocketDonkey
RocketDonkey

Reputation: 37269

Instead of accessing it as a with dot notation, you could try this:

while(result.hasnext()){ 

  res = result.next();
  var CustName = res["Cust Name"];

}

I tested this using a spreadsheet (since that is one way you can get a property with a space loaded), and it returned the correct value for a column with a space.

Upvotes: 1

Related Questions