表名:在test_tbl中选择item = mobile,并使用google-apps-script(google execl sheet)插入其他表名为other_tbl。
代码:
function readFromTable() {
var conn = Jdbc.getConnection(dbUrl, user, userPwd);
var start = new Date();
var stmt = conn.createStatement();
stmt.setMaxRows(100);
var results = stmt.executeQuery('SELECT * FROM test_table where Price ="100"');
var numCols = results.getMetaData().getColumnCount();
while (results.next()) {
var rowString = '';
for (var col = 0; col < numCols; col++) {
rowString += results.getString(col + 1) + '\t';
var cell_4 = rowString ;
}
Logger.log(rowString)
}
results.close();
stmt.close();
var end = new Date();
Logger.log('Time elapsed: %sms', end - start);
}