Select2Object

Select2Object

  • Executes a SELECT statement on sheet data. Returned data will be any array of objects, where each item is one row of data. The property values in the object are the column names. The column names will be in lower case. If more than one table is referenced, the column name will be: "table.column", otherwise it will just be the column name. Spaces in the column name use the underscore, so something like "Transaction Date" would be referenced as "transaction_date".

Constructor

new Select2Object()

Source:

Methods

addBindVariable(bindVar) → {Select2Object}

Description:
  • If bind variables are used in SELECT statement, this are added here. Ordering is important. The first one added will be '?1' in the select, second is '?2' in select...

Source:
Parameters:
Name Type Description
bindVar any
Returns:
Type
Select2Object

addTableData(tableName, data) → {Select2Object}

Source:
Parameters:
Name Type Description
tableName String

table name referenced in SELECT statement.

data *

double array or string. If string it must reference A1 notation, named range or sheet name.

Returns:
Type
Select2Object

execute(statement) → {Array.<Object>}

Description:
  • Query any sheet range using standard SQL SELECT syntax and return array of table info with column names as properties.

Source:
Example
gsSQL("select * from expenses where type = ?1")
Parameters:
Name Type Description
statement String

SQL string

Returns:
  • array of object data.
Type
Array.<Object>

(static) cleanupColumnNames(cols) → {Array.<String>}

Description:
  • Return column names in lower case and remove table name when only one table.

Source:
Parameters:
Name Type Description
cols Array.<String>
Returns:
Type
Array.<String>

(static) createEmptyRecordObject(columnNames) → {Object}

Description:
  • Creates an empty object where each column name is a property in the object.

Source:
Parameters:
Name Type Description
columnNames Array.<String>
Returns:
Type
Object

(static) createTableObjectArray(columnNames, tableDataArray) → {Array.<Object>}

Source:
Parameters:
Name Type Description
columnNames Array.<String>
tableDataArray Array.<any>
Returns:
Type
Array.<Object>