ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Import data from multiple files (https://www.excelbanter.com/excel-programming/425579-import-data-multiple-files.html)

Dean

Import data from multiple files
 
Hi,

I currently have a data query that imports data from multiple "TEXT" files
in a folder one file at a time when I select them.

I have to individually select the file, the query is run and imports the data.

Is it possible to have Excel open a folder, select all the files
(individually or all together) and import the data. the files are CSV.

I can then manipulate the data once it's in but the time consuming bit is
getting it in. I would use MS Access but don't have it....YET!

Thanks in advance.....


Jacob Skaria

Import data from multiple files
 
Daear Dean

The below code should do.......

Dim strFolder, strFile

strFolder = "C:\"
strFile = Dir(strFolder & "*.csv", vbNormal)
Do While strFile < ""
'Write your import code here
strFile = Dir
Loop


If this post helps click Yes
---------------
Jacob Skaria


Dean

Import data from multiple files
 
Jacob,

Looks brill. Thanks
Dean

"Jacob Skaria" wrote:

Daear Dean

The below code should do.......

Dim strFolder, strFile

strFolder = "C:\"
strFile = Dir(strFolder & "*.csv", vbNormal)
Do While strFile < ""
'Write your import code here
strFile = Dir
Loop


If this post helps click Yes
---------------
Jacob Skaria


Ron de Bruin

Import data from multiple files
 
Hi Dean

See also
http://www.rondebruin.nl/csv.htm

Or
http://www.rondebruin.nl/txtcsv.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"Dean" wrote in message ...
Hi,

I currently have a data query that imports data from multiple "TEXT" files
in a folder one file at a time when I select them.

I have to individually select the file, the query is run and imports the data.

Is it possible to have Excel open a folder, select all the files
(individually or all together) and import the data. the files are CSV.

I can then manipulate the data once it's in but the time consuming bit is
getting it in. I would use MS Access but don't have it....YET!

Thanks in advance.....



All times are GMT +1. The time now is 09:27 AM.

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