Mass Import Of Several Thousand Files Into One File
May 22, 2009
I am trying to do a mass import of several thousand excel files into one file. The headers of all the files are the same, but the data inside each file is different. I thought about using Access but it wants me to import each individual one.
I have zero experience in writing a Macro
View 12 Replies
ADVERTISEMENT
Apr 24, 2009
I have around 200 files, all named from 001.xls to 200.xls, all containing the same format, the same number of colums, but a different number of lines.
Now I have the great task to actually open all these files and copy each files data into one file and start analyzing it. Well, since I personally have no interest to open, copy and paste 200 hundred times, I am wondering if there is any faster way to let excel automatically copy the data into this master file?
I am thinking about somehing like *='001.xls'Sheet2!B2:E20*
One thing is that each file never has more than 20 entries, thus i would only need excel to import the from line 2 to 20 from a certain file and then do same thing all over again with the next file.
View 13 Replies
View Related
Mar 17, 2014
My associates have saved about 2,000 .zip files in a single repository. Each zip file contains a .pdf, and a file called "metadata.xml" - the metadata files are small, only 1-2Kb.
What I'd like to do is import the contents of each metadata.xml file into a single workbook so I can build an inventory of the pdf files.
The full path looks like this:
Z:PrincetonGlobal DataFinancial DataFinancial DataWCFNDL_PRODUCTION128650_TH1X0_ProTechLLC_A_Eng_BBOT__20140317132245.195_bbot.zip
Everything up to and including FNDL_PRODUCTION is exactly the same for each file. Everything after, varies, and is not predictable.
I'm thinking there is some way to say "for each file in repository, import metadata.xml content..."
View 6 Replies
View Related
Aug 15, 2014
All my files is in C:UsersmarrecoDownloads All files has name formatt (yyyymmdd) -> 20140814 I need import only last month files
Every day a system plays text files within the (C: Users drake Downloads ) folder.
E.g. I have to import only the files that have the name (yyyymmaa) based on last month.
[Code] ......
View 14 Replies
View Related
Oct 9, 2008
I have a directory where our customer service people deposit forms each day. The form is always the same, with a number of columns that need to be copied into a master list. From there they are analyzed, sorted, etc, then exported, so the number of rows in that list varies from day to day as well. Is there some way to have VBA import each file sequentially from a directory if I do not have the exact file names?
I am using this import code from a macro to start with:
Sub importdata()
' importdata Macro
Range("A2").Select
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DSN=Excel Files;DBQ=C:Documents and SettingsMy DocumentsTender Document(1).xls;DefaultDir=C:Documents a" _
[Code]....
View 9 Replies
View Related
Jul 25, 2014
I have a folder with multiple text files. I want to import one of these files to a sheet called data in an existing Excel file. The excel file has references to this data sheet on other sheets which I want to keep. I want to save this excel file with the name the text file has and repeat this for all the text files in the folder.
I found a macro a while back which does the job nicely of importing and saving the Excel file, however all the data in the other sheets gets lost once it is saved. How to keep the data?
Code:
Sub tgr()
Const txtFldrPath As String = "FOLDER WITH TEXT FILES" 'Change to folder path containing text files
Const xlsFldrPath As String = "FOLDER FOR EXCEL FILES" 'Change to folder path excel files will be saved to
Dim CurrentFile As String: CurrentFile = Dir(txtFldrPath & "" & "*.txt")
Dim strLine() As String
Dim LineIndex As Long
[Code].....
View 4 Replies
View Related
Oct 9, 2008
I have a directory where our customer service people deposit forms each day. The form is always the same, with a number of columns that need to be copied into a master list. From there they are analyzed, sorted, etc, then exported, so the number of rows in that list varies from day to day as well. Is there some way to have VBA import each file sequentially from a directory if I do not have the exact file names?
I am using this import code from a macro to start with: .....
View 9 Replies
View Related
Jul 12, 2012
I need to import thousand of txt files into 1 worksheet keeping the file names as data. Each txt file has 2 columns :
1 0.65914
2 0.65945
3 0.86062
... ...
and each txt file represents recordings made at specific time and date (e.g 0158.DSG_RAWD_HMS_21_ 0_ 0__DMY_29_ 2_12_pulses). I would like to have 2 columns: 1) with the time taken from the name of the txt file (e.g. 21:00:00) and 2) the associated recording. Something like this:
21:00:00 0.65914
21:00:00 0.65945
21:00:00 0.86062
and so on for each txt file and all the recordings piling up in 1 spreadsheet. I have tried to run few codes in VBA, but I have no knowledge of it and none of the code worked. I am using Excel 2010.
View 1 Replies
View Related
Apr 10, 2014
I have around 50 text files with similar design per attached file. I need to import the text files with criteria below:-
1. include file name
2. let user choose the folder
3. exclude data from "work in process summary" to "work in process cost totals"
4. only have one title in the excel files which all text files is combined "Item, Line ....."
5. If the text files do not have title like "Item, Line, ..." do not import
Is it possible to have all criteria listed above by running a macro?
A.txt
View 1 Replies
View Related
Jan 29, 2008
I'm attempting to import around 200 (and growing!) separate text files into Excel. I am using the formula below to import the text file and then using a separate macro to select the information I need, copy it into another spreadsheet, and then run the import macro again.
However, I have a problem in that my import macro gives me 'Run-time error '1004:
Application defined or user defined error''. At first this wasn't a problem as the information is pasted into the spreadsheet despite the error anyway. However, now that I am looping the macro it is obviously causing more problems as it prevents the loop. I would really appreciate it if anyone knows of a work-around or can spot an error in the coding to resolve this!
The code below shows is for the import macro only:
Sub ImportTextFile(FName As String, Sep As String)
Dim RowNdx As Long
Dim ColNdx As Integer
Dim TempVal As Variant
Dim WholeLine As String
Dim Pos As Integer
Dim NextPos As Integer
Dim SaveColNdx As Integer
View 8 Replies
View Related
Jul 13, 2006
I'm using the following code to import thousands of html files into my spreadsheet. The code is working fine. Since I am importing thousands of files, when there is no more space on my worksheet, the code stops with an error message. I want to make this code add another worksheet & continue importing the html files until there are no more files to import.
Sub Master_Importer()
Dim I As Long
Dim strFilename As String
Dim strPath As String
strPath = "file:///C:/Documents and Settings/c/Desktop/New Folder/"
With Application.FileSearch
.LookIn = "C:Documents and SettingscDesktopNew Folder"
.FileType = msoFileTypeAllFiles
.Execute
For I = 1 To .FoundFiles.Count
strFilename = Mid(.FoundFiles(I), InStrRev(.FoundFiles(I), "") + 1)
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;" & strPath & strFilename _ .......................
View 5 Replies
View Related
Oct 28, 2011
Actually i've downloaded Tracking report of my SPO and this report is on 4-5 csv files (1 file per week). I have to gather data from these 4 files into one Worksheet. I have to do this with command button on my worksheet; with Open file dialogue box (i want to locate the csv files).
CSV files are something like that (I need only first 4 columns):
ABCDE1Name MSISDN Date Location MapLink 2M. Younus Safi "923***550577" "2011-10-07 20:36:18" "ACB Tower Badragah Chakwal. Badraga" "http://asdf.com" 3M. Younus Safi "923***550577" "2011-10-07 19:36:26" "ACB Tower Badragah Chakwal. Badraga" "http://asdf.com" 4M. Younus Safi "923***550577" "2011-10-07 16:39:58" "ACB Tower Badragah Chakwal. Badraga" "http://asdf.com" 5M. Younus Safi "923***550577" "2011-10-07 15:37:23" "ACB Tower Badragah Chakwal. Badraga" "http://asdf.com" 6M. Younus Safi "923***550577" "2011-10-07 14:37:05" "ACB Tower Badragah Chakwal. Badraga" "http://asdf.com"
and my Worksheet is like that (With a command Button):
I want to import first 3 columns of csv file on first 3 columns on my worksheet; leave 2 columns blank and then import the 4th column... now for example i have done importing data from 1st csv file and the data is on 50 rows.. i click the command button again, locate the 2nd csv file.. do the same thing (import 1st 3 columns, 2 blank, then 4th) --from 51st Row-- and so on...
ABCDEF1NameMSISDN DatedBlankBlank Location2
3
4
5
6
7
View 4 Replies
View Related
Jun 3, 2009
I have a workbook with many spreadsheet named Sheet1, Sheet2 and so on. Each sheet is filled completely upto 65536 rows. This data is being picked up from a CSV file. In this file there are sites with each site there is a assciated set of data. What happens is the data that extracts data does not differntiate between sites and when it reaches to the end of worksheet it splits the data into next sheet. So I am trying to create a macro to check each spreadsheet starting with the last sheet in the work book for example last sheet in the workbook is seven it should go to sheet6 and if there is a blank row after row 64000 it should cut all the rows and move them to sheet7. Then it should goto sheet5 and do the same and keep on doing it until it reaches sheet1.
View 9 Replies
View Related
Nov 3, 2009
I am trying to import some csv files so I can combine them, but am having probs with the filename and location.
Sub test()
Dim wsName As String
wsName = ActiveCell
Sheets("Data").Select
With ActiveSheet.UsedRange
LastRow = .SpecialCells(11).Row
End With
With ActiveSheet.QueryTables.Add(Connection:="TEXT; &thisWorkbook.Path &" " & wsName &", Destination:= Range("A" & LastRow))
.Name = wsName
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells.....................
View 5 Replies
View Related
Feb 21, 2008
I would like to create a macro that looks in a specific directory "h:data"
It finds the 6 most recently modified files in this directory (csv files)
Then imports these 6 files into seperate worksheets in the same workbook "sorter.xls"
View 9 Replies
View Related
May 13, 2008
1. I've recorded a macro that imports values from 6 different .csv files at once. The problem is that not all of these files are going exist upon import. Is there a way to tell the macro to only import if the file exists? And to skip if the import of that file if it doesn't exist? Right now the debugger stops the macro because of file not found.
2. I want to press a button on Sheet 1 that copies Sheet 1 into a new Sheet that's named with today's date. E.g. I press the "Archive"-button, the sheet is copied to a new sheet with the name "051308".
View 9 Replies
View Related
Sep 18, 2008
I need to import about 1500 HTML file into a DB (SQL Server). But (here is the big problem), I only need to import some data of each HTML file (always the same line/variable).
So I thought using Excel as you can say with part of the HTML file you want to import. It works great.
But I did it with one file. Is there a way you can select a whole directory and it does it for you?
View 9 Replies
View Related
Nov 20, 2007
I have a question regarding importing data. What I need to do is specify a certain directory and this directory contains multiple Excel files. I would like to open each file and extract certain data from each workbook. I should be ok to figure that part out (the data extraction) but I am really confused on how to open each excel file in the directory.
View 3 Replies
View Related
Jun 26, 2009
Need a way to update a single master file. What happens right now is that the cost manager sends out one file to a lot of different project heads and then on having them return back to him he basically has to individually add in all the data. What i am trying to do is that he somehow carries on sending out the data as there are a lottt of projects and then on returning them they automatically update.
View 14 Replies
View Related
Jan 9, 2014
I import into my website a standard .csv file that contains product details from my supplier. Columns contain info such as RRP, Wholesale Price etc and rows for each product. For some reason thats only known to my supplier the text descriptions of each of the products are held on a seperate .txt file, in a separate folder with the .txt filename recorded one of the columns cells, one for each product. There are 1000's of products, each with its own .txt file such as 38675.txt, 37828.txt. As you can imagine to copy and paste into each products cell or to manually import each .txt will take the rest of my life.
how I could automate the input of the diferent .txt contents into the required cells.
View 9 Replies
View Related
Jun 1, 2009
I am trying to import a several files depending on date. The first part of the name of the files that I am importing are always the same, the end changes as the date changes.
I have a user form that comes up and I pick the dates that I am looking at.
What would be the code to import those depending on the date that I pick?
When my UF comes up, I pick whatever dates, I need to import all the files in between those dates.
View 11 Replies
View Related
Sep 29, 2009
I need to import a number of log files into a spreadsheet, each log will go into a separate tab. The logs are text files (.log) that have the same structure but slightly differ from each other.
For example all the logs will have many lines of data all starting with a date and then a number of delimited fields. In some logs the delimiter is a coma, in others is a unique charachter such as "{" or "@". Also the delimited fields are not a given quantity, they can vary too from log to log. How can I write a macro that understands what delimiter needs to be used and then imports all the file accordingly into one spreadsheet (in separate tabs)?
I tried something with the macro recorder and browsed for directions on the internet but really am clueless on this one. I am using windows 2000, and referenced Windows Scripting Runtime.
View 3 Replies
View Related
May 17, 2011
I'm looking for a macro that will import multiple .csv files from c: emp each into their own separate worksheet.
View 5 Replies
View Related
Jan 20, 2012
So I have a few thousand .html-files that i need two lines from. It is line 43 and line 46. I want those lines in each cell and the dokument name in the last cell. After that it goes 1 row down and takes the next html-file.
So it would be something like:
Row 1 | line43 | line46 | Dok1
Row 2 | line43 | line46 | Dok2
View 3 Replies
View Related
Nov 13, 2012
I've got 80 CSV files that I need to import into an Excel sheet. The filenames are sequential, eg 1APN .... 80APN). I need each chunk of data added after the previous. How can I do this using VB?
View 2 Replies
View Related
Oct 6, 2008
I am using the following to import a text file w/ ~86000 lines into Excel: ...
View 9 Replies
View Related
Jul 17, 2006
I am trying to write a macro which creates a new worksheet with the name kenmerk (i) and then import five different textfiles in this worksheet.
I was wondering how to define the name of the textfiles in the code. The code I get with record macro is: ...
View 6 Replies
View Related
Jul 26, 2006
My text files look like this(each has different number of rows):
2006-08-25 13:33:20 82,8 g
2006-08-25 13:34:10 58,5 g
between each column there is Tab
To import them from one directory (directories are named as month e.g. 8) I used:
Sub Consolidate()
Dim mnthNum As Integer
Dim myBook As Workbook
Dim myRows As Long
With Application
.DisplayAlerts = False
.EnableEvents = False
. ScreenUpdating = False
End With
and it works almost perfectly.. the problem is that each time it loads next file it overwrites the previous..
e.g. if i have in my directory 4 files and sum of the rows is 20 it will show only 17. The import is good because I checked it with debugger but each time a new file is copied it starts from last row of previous file.. that's the problem I can't solve...
View 5 Replies
View Related
Dec 11, 2007
I have about 200 text files each with 2 columns. I want to create a single excel spread sheet where the data comprises of the second column from each text file. I do not know any thing about macros and so need help on writing a macro that will automatically import data from the whole of the second column of each text file into one single spread sheet.
View 7 Replies
View Related
Jan 12, 2008
i have five different formats of data files i.e. different columns in count as well as heading. i want to import selected six columns from every file in a single sheet for data manipulation. can this be done anyways. The format for result file is standard with six columns only.
View 4 Replies
View Related