text 只需单击按钮或预定时间,即可将数据从MySQL数据库提取到Google doc电子表格。这对re来说非常有用

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 只需单击按钮或预定时间,即可将数据从MySQL数据库提取到Google doc电子表格。这对re来说非常有用相关的知识,希望对你有一定的参考价值。

// MySQL to Google Spreadsheet By Pradeep Bheron
// Support and contact at pradeepbheron.com

function myMySQLFetchData() { 
  
  var conn = Jdbc.getConnection('jdbc:mysql://127.0.0.1:3306/employee_db', 'username', 'pass'); // Change it as per your database credentials

  var stmt = conn.createStatement();
  var start = new Date(); // Get script starting time
  
  var rs = stmt.executeQuery('SELECT id,emp_name, emp_code FROM employee_details GROUP BY 1 LIMIT 1000'); // It sets the limit of the maximum nuber of rows in a ResultSet object
  
  //change table name as per your database structure
   
  var doc = SpreadsheetApp.getActiveSpreadsheet(); // Returns the currently active spreadsheet
  var cell = doc.getRange('a1');
  var row = 0;
  var getCount = rs.getMetaData().getColumnCount(); // Mysql table column name count.
  
  for (var i = 0; i < getCount; i++){  
     cell.offset(row, i).setValue(rs.getMetaData().getColumnName(i+1)); // Mysql table column name will be fetch and added in spreadsheet.
  }  
  
  var row = 1; 
  while (rs.next()) {
    for (var col = 0; col < rs.getMetaData().getColumnCount(); col++) { 
      cell.offset(row, col).setValue(rs.getString(col + 1)); // Mysql table column data will be fetch and added in spreadsheet.
    }
    row++;
  }
  
  rs.close();
  stmt.close();
  conn.close();
  var end = new Date(); // Get script ending time
  Logger.log('Time elapsed: ' + (end.getTime() - start.getTime())); // To generate script log. To view log click on View -> Logs.
}

以上是关于text 只需单击按钮或预定时间,即可将数据从MySQL数据库提取到Google doc电子表格。这对re来说非常有用的主要内容,如果未能解决你的问题,请参考以下文章

javascript 当您单击浏览器操作图标时,只需极少的Chrome扩展即可将JS文件注入给定页面。然后脚本插入一个n

javascript 当您单击浏览器操作图标时,只需极少的Chrome扩展即可将JS文件注入给定页面。然后脚本插入一个n

json 当您单击浏览器操作图标时,只需极少的Chrome扩展即可将JS文件注入给定页面。然后脚本插入一个n

循环中更改数据的问题:它是 v-for 的功能还是组件的错误或我的代码的错误?

bartender 命令行在哪

我可以以编程方式单击按钮以获得预定义的意图吗?