This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(RODBC) | |
| con <- odbcConnectAccess2007("D:/Backup/OSS & TS - Performance/OSSDatabase.accdb") | |
| # sqlTables(con) | |
| topQuery <- "select top 10 * | |
| from qry_RL_Portfolio_M | |
| where Month between '201701' and '201709' | |
| and Result = 'A';" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var uploadFile = JSON.parse(UrlFetchApp.fetch( | |
| "https://www.googleapis.com/upload/drive/v2/files?uploadType=media&convert=true", | |
| { | |
| method: "POST", | |
| contentType: file.getMimeType(), | |
| payload: file.getBlob().getBytes(), | |
| headers: { | |
| "Authorization" : "Bearer " + ScriptApp.getOAuthToken() | |
| }, | |
| muteHttpExceptions: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas_access as mdb | |
| # show tables in databases | |
| for tbl in mdb.list_tables('/Users/Danny/Share Win7/2017OSSDatabase.accdb'): | |
| print(tbl) | |
| # Read in table as pandas dataframe | |
| # Limited capability to small tables | |
| df = mdb.read_table('/Users/Danny/Share Win7/2017OSSDatabase.accdb', 'Region_KTC') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import jaydebeapi | |
| # Initiate Java runtiome file location | |
| ucanaccess_jars = [ | |
| "/Users/Danny/Documents/UCanAccess-4.0.2-bin/ucanaccess-4.0.2.jar", | |
| "/Users/Danny/Documents/UCanAccess-4.0.2-bin/lib/commons-lang-2.6.jar", | |
| "/Users/Danny/Documents/UCanAccess-4.0.2-bin/lib/commons-logging-1.1.1.jar", | |
| "/Users/Danny/Documents/UCanAccess-4.0.2-bin/lib/hsqldb.jar", | |
| "/Users/Danny/Documents/UCanAccess-4.0.2-bin/lib/jackcess-2.1.6.jar", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on Fri Jun 30 15:33:09 2017 | |
| @author: Thanakrit.B | |
| """ | |
| import pyodbc | |
| # Check if MS Access driver availabel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Date data in Excel stored in format no. of day from origin (1899-12-30) | |
| # While POSIXct use format no. of second from origin | |
| # Then convert form #day -> #second | |
| textWinDateConv2 <- function (d) { | |
| t <- as.POSIXct(as.numeric(d) * 60*60*24 , # Convert days to second for POSIXct time scales | |
| # Set origin to Bankok minus 17 min 56 sec for correct timezone origin before 1920 | |
| # https://en.wikipedia.org/wiki/Time_in_Thailand | |
| origin = (as.POSIXct("1899-12-30", tz = "Asia/Bangkok") - (17*60+56)), | |
| tz = "Asia/Bangkok") # To assure out put time zone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # install the new/experimental plotly R package | |
| # devtools::install_github("ropensci/plotly@carson-dsl") | |
| # ---------------------------------------------------------------------- | |
| # https://plot.ly/r/3d-line-plots/ | |
| # ---------------------------------------------------------------------- | |
| library(plotly) | |
| # initiate a 100 x 3 matrix filled with zeros |