2017-04-22 8 views
0

大きすぎるため、Excelで開くことができないさまざまな.xlsファイルがあります。 私はそれらをAccess 365にインポートしようとしていますが、Accessがファイル内の情報にアクセスできないというエラーが発生しています。 私は今朝いくつかのフォーラムからアドバイスを読んできましたが、上記のようにファイルを開くことができないため、ファイルを開いて.xlsxで保存する必要があるため、唯一の提案は実行できません。 アドバイスをいただければ幸いです。.xlsファイルをAccess 365にインポートする

答えて

1

どのようにExcelファイルをExcelで開くことができますか?ファイルを作成するには、ある時点でExcelを使用している必要があります。唯一の制限は、私が知っているように、あなたが作業しているマシンのRAMです。

次のスクリプトを試すことができますか?

Sub Import() 

     Dim strPathFile As String, strFile As String, strPath As String 
     Dim strTable As String 
     Dim blnHasFieldNames As Boolean 

     ' Change this next line to True if the first row in EXCEL worksheet 
     ' has field names 
     blnHasFieldNames = False 

     ' Replace C:\Documents\ with the real path to the folder that 
     ' contains the EXCEL files 
     strPath = "C:\Documents\" 

     ' Replace tablename with the real name of the table into which 
     ' the data are to be imported 
     strTable = "tablename" 

     strFile = Dir(strPath & "*.xls") 
     Do While Len(strFile) > 0 
       strPathFile = strPath & strFile 
       DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _ 
        strTable, strPathFile, blnHasFieldNames 

     ' Uncomment out the next code step if you want to delete the 
     ' EXCEL file after it's been imported 
     '  Kill strPathFile 

       strFile = Dir() 
     Loop 

End Sub 

アクセスがそれを扱うことができない、と私は信じがたい、あなたが仕事をするためにSQL Serverを使用できることが判明した場合。

http://www.accessmvp.com/KDSnell/EXCEL_Import.htm

Select * into SQLServerTable FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=D:\testing.xlsx;HDR=YES', 'SELECT * FROM [Sheet1$]') 

http://www.ashishblog.com/importexport-excel-xlsx-or-xls-file-into-sql-server/

それとも...この作業のためにRを使用しています。

library(xlsx) 
file <- system.file("tests", "test_import.xlsx", package = "xlsx") 
res <- read.xlsx(file, 1) # read first sheet 
head(res[, 1:6]) 

http://www.sthda.com/english/wiki/r-xlsx-package-a-quick-start-guide-to-manipulate-excel-files-in-r

これらのオプションのいずれも動作しない場合は、私はExcelファイルが破損している可能性があり、そしてそれはまったく違う問題だと言うでしょう。

+0

こんにちは。上記のすべてをありがとう。 RAMは仕事用ラップトップが対処していないように見える問題です。これらのファイルはOracleデータベースからのシステム・ダウンロードなので、ユーザーによって作成されていません。しかし、私がファイルを扱うためにアクセスを使用していた問題は、ファイルが.xlsであり、アクセスがデータを読み取れなかったという事実に関連しているようでした。 –

関連する問題