how to read .xlsx file in r code example
Example 1: read xlsx in r
require(gdata)
df = read.xls ("myfile.xlsx"), sheet = 1, header = TRUE)
Example 2: read xlsx in r
require(RODBC)
conn = odbcConnectExcel("myfile.xlsx") # open a connection to the Excel file
sqlTables(conn)$TABLE_NAME # show all sheets
df = sqlFetch(conn, "Sheet1") # read a sheet
df = sqlQuery(conn, "select * from [Sheet1 $]") # read a sheet (alternative SQL sintax)
close(conn) # close the connection to the file