Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

問題

有什麼方法來匯入使用 rxImport().xlsx Excel 檔案。rxImport() 有 ODBC 功能。

方案

如果您可以安裝適當的 ODBC 連線字串,表示正確的查詢,但尚未經過測試,這或許可以。我需要調查是否支援此功能。您是否能夠確認您可以連線至,並透過 ODBC R 之外的 Excel 試算表的查詢?您可以提供您嘗試執行您正在執行的 Excel 的版本以及完整的指令碼。

如果這不會使用 rxImport,另外也可以有更直接 Excel/ODBC 支援 RODBC 套件。這樣會將 Excel 試算表帶進 XDF 檔案無法再寫入的資料框架。

以下是簡短的一般範例的 Excel 活頁簿匯入.xdf 檔案︰

sConnectionStr <- "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DriverId=790;Dbq=C:/Data/ODBCTest.xlsx;DefaultDir=c:/Data;" testExcel = "SELECT * FROM [Sheet1$]" 
excelDS<- RxOdbcData(sqlQuery = testExcel, connectionString=sConnectionStr) 
excelDS_XDF<- RxXdfData("testFromExcel.xdf") 
rxImport(excelDS, excelDS_XDF, overwrite=TRUE)

Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×