ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Importing a large amount of data using Basic (https://www.excelbanter.com/excel-programming/330114-importing-large-amount-data-using-basic.html)

MrsButtersworth

Importing a large amount of data using Basic
 

Hi,

I have 16,000 files that need to be imported into an excel spreadsheet.
Ideally, each file (with about 100 different variables) would
automatically import into its own row. I'm looking for help in
creating something that will automatically go through a folder, open
each file (comma delimited), and put all the data from each file in its
own row.

Any help is Greatly Appreciated.


--
MrsButtersworth
------------------------------------------------------------------------
MrsButtersworth's Profile: http://www.excelforum.com/member.php...o&userid=23724
View this thread: http://www.excelforum.com/showthread...hreadid=373997


Tim Williams

Importing a large amount of data using Basic
 
You can use dir() or the filesystem object to loop through all files
in a directory.

eg from:
http://groups-beta.google.com/group/...8c04cb38a6cbb2


Sub AllFolderFiles()
Dim wb As Workbook
Dim TheFile As String
Dim MyPath As String
MyPath = "C:\Temp"
ChDir MyPath
TheFile = Dir("*.xls") 'adjust extension
Do While TheFile < ""
Set wb = Workbooks.Open(MyPath & "\" & TheFile)
MsgBox wb.FullName
wb.Close
TheFile = Dir
Loop
End Sub


Open each file and copy the relevant information to your "master"
Excel sheet.

I would guess that 16000 files would take a long time though.

Tim.



"MrsButtersworth"
<MrsButtersworth.1plpvh_1117047663.5652@excelfor um-nospam.com wrote
in message
news:MrsButtersworth.1plpvh_1117047663.5652@excelf orum-nospam.com...

Hi,

I have 16,000 files that need to be imported into an excel
spreadsheet.
Ideally, each file (with about 100 different variables) would
automatically import into its own row. I'm looking for help in
creating something that will automatically go through a folder, open
each file (comma delimited), and put all the data from each file in
its
own row.

Any help is Greatly Appreciated.


--
MrsButtersworth
------------------------------------------------------------------------
MrsButtersworth's Profile:
http://www.excelforum.com/member.php...o&userid=23724
View this thread:
http://www.excelforum.com/showthread...hreadid=373997





All times are GMT +1. The time now is 01:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com