Skip to content

Commit

Permalink
b3 add xlsb example
Browse files Browse the repository at this point in the history
  • Loading branch information
renkun-ken committed Apr 5, 2014
1 parent 668a1a8 commit f291ceb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Binary file added data/namelist.xlsb
Binary file not shown.
19 changes: 17 additions & 2 deletions src/b3.database.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
# SELECT FROM WHERE ORDER BY
# SELECT FROM WHERE GROUP BY

## Excel Worksheet
## ODBC

### Excel Worksheet


library(RODBC)
conn <- odbcConnectExcel2007("data/namelist.xlsx",readOnly = TRUE)
sqlTables(conn)
Expand All @@ -16,8 +20,19 @@ grades <- sqlQuery(conn,"SELECT * FROM [Grades$]")
df <- sqlQuery(conn,"SELECT * FROM [Students$] INNER JOIN [Grades$] ON [Grades$].Name = [Students$].Name")
odbcClose(conn)

### Excel Binary Worksheet
# http://social.msdn.microsoft.com/Forums/en-US/0993e144-2e32-4915-be17-ff076902f983/excel-binary-workbook-xlsb?forum=isvvba

library(RODBC)
conn <- odbcConnectExcel2007("data/namelist.xlsb",readOnly = TRUE)
sqlTables(conn)
students <- sqlFetch(conn,"Students")
grades <- sqlQuery(conn,"SELECT * FROM [Grades$]")
df <- sqlQuery(conn,"SELECT * FROM [Students$] INNER JOIN [Grades$] ON [Grades$].Name = [Students$].Name")
odbcClose(conn)


## SQLite database
## SQLite
# http://www.sqlite.org/
require(RSQLite)

Expand Down

0 comments on commit f291ceb

Please sign in to comment.