Excel 2010 :: Import Data From Multiple CSV Files?
Dec 14, 2012
I have small bit of import code (below), that I am looking to modify. The data that I am importing is for an inventory tool that determine optimal on hand quantities and alerts to any issues. In the past there had been one inventory source (one .csv data file). So I populate that to one sheet and modify the data on that sheet. I now have multiple data sources that I need to address.
There are two things that I would like to add/be able to do.
1) I would like to add a dropdown or set of multiple buttons to the popup window that says "Select the OnHand Report". Previously I only had one report source which I posted to sheet "orow0205". I have 2 other data files now that I have to import and they need to go to sheets "orow0206" and "orow2144". I am grabbing the data the same way on each sheet so that doesnt need to change I just need the option on the pop up window to determine the sheet name I want the import to go to.
2) The files that come from the sources above have a file name like "20121213_00000_groupstatistics.csv". Where the first eight digits represent the date the file was generated. If possible, after I select the sheet via the popup solve above, I would like to have the date populated in "MM/DD/YYYY" format in the last column of the imported data (the same date for each row of data imported). The file imported has no date data on it and can represent any day (which is why I am not using some form of TODAY formula).
I am currently using Excel 2010.
Sub AddData()
' Import_New_data
'
'Open Datafile
[Code]....
View 4 Replies
ADVERTISEMENT
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
Mar 27, 2014
I am trying to determine a way to quickly import data from text files into Excel and place data in suitable columns (under correct headings). I am thinking I could be asked which file to read and import doing them 1 by 1, or if there is an automated way to cycle through all the files that would be more efficient (filenames are variable).
From the text files I have attached I can tell the column headers and what data should go under each. Not sure how you would describe the delimiting on these files? Are these files in a format that VBA could be used to reduce manual copy and paste approach? I have about 300 of these files I want to extract the data from.
Note: the attached files are from a public access website.
WELLS0214.TXT WELLS0106.TXT
View 4 Replies
View Related
Sep 13, 2013
I'm trying to create some vba code that will go into other .xlsx documents, pull all cells with a value in the first 30 columns and then return them as a table. Basically each work crew has a .xlsx spreadsheet containing their schedule and I am trying to bring them all together into one nice little package. If I go to import from external sources then click XML data, navigate to the folder they are in and them click show all files and pick my spreadsheet it imports nicely. Then I go to the next blank cell in column "A" and repeat for the 4 crews. Now I can filter by each crew but all 4 are visible on a single page as a table. I recorded a macro that shows everything I did, but it is not dynamic (the .xlsx source files name changes based on the month) I'm running XP sp3 with Excel 2010
Here is a copy of what I have
Code:
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array( _
"OLEDB;Provider=Microsoft.ACE.OLEDB.12.0;Password="""";User ID=Admin;Data Source=C:Documents and SettingsUSERNAMEDesktopSCHEDULE STUF" _
, _
"FAcrewCurrent.xlsx;Mode=Share Deny Write;Extended Properties=""HDR=YES;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path=""""" _
, _
";Jet OLEDB:Database Password="""";Jet OLEDB:Engine Type=37;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;J" _
, _
"et OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="""";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt " _
[code].....
Is there a better or simpler way to do this? The tables don't need to be forever linked to their previous spreadsheets so if copy/pasting is a better way than I am all for that as well.
View 1 Replies
View Related
Dec 6, 2012
I have some 400+ .txt tab delimit files in the same format in the same directory. All of them have 4 cols. I would like to use a VB sub code to import col1's of all .txt files to a workbook sheet1 filing from col1 to coln in excel sheet1. And col2's of all .txtx files to sheet2 of the same workbook. An so on. I found a code that can import the col1's from .txt files to excel sheet1 only. But not col2's to sheet2.
View 6 Replies
View Related
Dec 6, 2009
-I receive files everyday by email and saved in a folder C:TEST
-each file saved by name Name+daily date
•( like: sale_20091214, sale_20091215, sale_20091216 )
-file is in csv/Comma delimiated format
-each file have 7 columns A to G and contain 256 rows
-i only need 7 or 8 rows & only need value in Column 'F'
-the rows i need are going to be same each time
--------------------------------------------------------------------------
I want to save automated data in a file name: MonthlySale located in c:
Fore each ROW data should be saved in new column next to last saved column.
.
Example:
data from file sale_20091214 should be saved in column B,
sale_20091214 should be saved in column C,
sale_20091214 should be saved in column D and onward.
View 8 Replies
View Related
Nov 11, 2011
I found a good piece of code to import data from text files into excel. they are delimited
I keep getting an overflow error, and then I get the error that the file is already open?
Option Explicit
Sub OpenTextFiles()
Dim strFiles() As String
Dim strFName As String
Dim strFPath As String
Dim IntFile As Integer
Dim sep As String
'define the directory
strFPath = "C:UsersXXXXXDesktopHOLDINGTEXT into Excel"
[Code] ..........
View 9 Replies
View Related
Jun 5, 2014
I am trying to take multiple tables from a Word document and import them into an Excel worksheet. Currently I have found two versions that when combined, could yield what I am looking for. The first one imports the table's data from Word, but does not maintain formatting of the table (font, colors, rows/columns etc.):
The next code maintains formatting, but only imports/pastes one table:
[Code] .........
For the second one, I do not like the fact that it is calling a specific Workbook to paste into. If I could somehow maintain the ability to import/past multiple tables while keeping formatting that would be perfect. An extra bonus would be to import each table within the Word document into individual Worksheets in Excel. I am also using Office 2010.
References: [URL] .........
VBA - How to preserve source formatting while copying data from word table to excel sheet using VB macro? - Stack Overflow
View 14 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
Apr 23, 2012
Is it possible to disable Import Data Dialog box in Excel 2010? I have a web query file. I want to copy its content and paste in a new worksheet under an existing workbook. I have a macro which does that but I get Import Data dialog box when I tried to paste the copied content from test.iqy file to new sheet. The dialog box has
Select how you want to view this data in your workbook?
By default Table is selected, which is fine.
Where do you want to put the data?
By default New workbook is selected. I want to have Existing worksheet selected by default.
Is there a way to set these requirements into vba code and make this dialog box not appear at all?
View 2 Replies
View Related
Apr 27, 2012
I am using Excel 2010 and I want to import data from a text file, but the problem is that the data is more than 1048576 rows of excel. Is there any solution though codes if one sheet fills up and import remaining data to other sheets ?
View 2 Replies
View Related
Aug 16, 2012
Excel 2010, Windows 7
I have a whole ton of *.dbf files (98 to be exact), that are from ArcGIS shapefiles. These date1_date2.dbf files have point names, and values, as shown below.
NAMERASTERVALU
Point 1-9999.00000000
Point 2-9999.00000000
Point 3-9999.00000000
Point 4-4.93072701
Point 5-8.90071201
I'm trying to figure out how to transpose each of the dbf files and save them as a text file (tab deliminated). My original plan involved saving them all as text files, then using a convoluted Unix script (I'm what you call a "dirty programmer") to transpose them and then combine them all into a single file. Since there are so many files (and I plan to do this in the future as well), I thought if I could at least automate the text file creation, I'd be ahead of the game. Even better would be a macro that will transpose the data for EACH file, then create a 99 (98 files + header row) row, 5 column text file. Creating the text files (1 text file for each dbf file) automatically .
All the *.dbf files will have exactly the same # rows/columns (2 columns, 6 rows)
This is what I've tried so far.
1)open one of the dbf files in Excel
2)record my marco (using the Personal Macro Workbook option - so it will be available in any workbook)
2a) transpose data (and paste it right below the original data so that the new data is in rows 7 and 8 of the same file)
2b) save as text file (tab deliminated)
2c) stop recording, and end up with this:
NAMERASTERVALU
Point 1-9999.00000000
Point 2-9999.00000000
Point 3-9999.00000000
Point 4-4.93072701
Point 5-8.90071201
NAMEPoint 1Point 2Point 3Point 4Point 5
RASTERVALU-9999.00000000-9999.00000000-9999.00000000-4.93072701-8.90071201
So now I want to apply the macro I just created to all open workbooks (after I bring in all the bdf files), but the macro isn't listed when I click the "view macros" button. All I want to do is apply the steps I recorded in the macro to all open workbooks.
View 6 Replies
View Related
Jun 23, 2013
I have obtained a piece of code from online that runs a macro on multiple files in a single given a single folder. when i implement it though it throws a run time error 424 "object required' and point to 'Documents.Open FileName:=path & file' line of code. Is this because Dim file type is not declared?how do i fix this problem. also, im using excel 2010.A
VB:
Sub Mac()
Dim file
Dim path As String
[Code]....
View 4 Replies
View Related
May 11, 2012
I'm working on a project where I need to import 150 csv files into an Excel2010 workbook, with each csv file being on a seperate worksheet.
I would like to set up a macro to point to the folder I will have these saved in this up so that each month when I get updated csv files I can repeat the process and bring in the new data. how to create this, I'm very new to VBA?
View 1 Replies
View Related
Sep 22, 2013
For the last year I have been downloading cash register X1 and Z1 files onto an SD card. Each night's files (X1 & Z1) are stored in a new folder with the naming convention "RP + [DATE]", (EX: RP120910, [YYMMDD]). I have 265 folders! I need to go through each folder, select the Z1 file (I don't care about the X1, X2 or Z2 files) and rename each with the following naming convention: "Z1 + folder_name + .xls". For Example: Folder RP120910 contains the Z1 file named "Z1_T1729.ECR". After renaming, the file should be "Z1RP120910.xls". As the VBA code loops through each subfolder, selecting and renaming the Z1 files, I would like the new files to be placed into a new folder named "Z1Files". Note: All subfolders are currently in a directory named "RegisterFiles". I am using Excel 2010.
View 3 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
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
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
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
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
Dec 22, 2011
I have about 10k poorly formatted txt files that I need to grab 4 items from each and put in a spreadsheet. How can this be done in Excel or should it be done in Access instead?
Here's a link to what each txt file looks like: MTRP88PF700721.txt
I only need the number next to Posting Journal on line 3 (12686 in this case), the 3 digit number next to Class Total on line 11 (101 in this case), the Extended Cost Final Total and the Extended Retail Final Total (23.77 and 39.30 in this case)
because one of my staff members is currently opening each txt file and typing these figures into a spreadsheet!
View 7 Replies
View Related
Feb 26, 2012
Need to import multiple text files in one shot. (Excel only allows 1 at a time)
Most file names are similar just numbered. ex. JoeBlowfile 1.txt, JoeBlowfile 2.txt, JoeBlowfile 3.txt, etc......
All text files have 30 lines of text
For example: JoeBlowfile 1.txt will start at A1 and end at A30, then JoeBlowfile 2.txt starts at A31 and ends at A60 and so on.....
May need to import 1 to 10000 files at a time.
all in 1 row single line starting at A1
once all files are imported need to export to 1 single text file file saved in XXXX folder with XXXX.txt name.
View 6 Replies
View Related
Jul 16, 2014
I have something like 10 folders. In each folder, I have 300 .xls files and 300 .txt files which have the same name : REF01, REF02, REF03...
Each time, I have to import the .txt file in the .xls file which has the same name in the same folder. I have some other operations to do : filter, etc...
I registered a macro to automatically import the .txt file and do the operation. But, the "register macro tool" has a problem : I asked him to import REF01 during the register, and now he is stuck to this file and import it every time I execute the macro. So, he imports REF01.txt in REF02.xls, in REF03.xls, when it should import REF01.txt in REF01.xls, REF02.txt in REF02.xls...
I don't know a thing in VBA. i tried to study the code but didn't manage to improve it. Here it is :
Sub BESTBESTMACROEVER()
'
' BESTBESTMACROEVER Macro
'
' Touche de raccourci du clavier: Ctrl+u
'
Sheets("Feuil2").Select
Sheets("Feuil2").Name = "Anerorpoin"
[Code] ......
View 1 Replies
View Related
Feb 29, 2008
rearrange this macro for me that I could import multiple txt (200 files) files from selected folder. Could You insert appropriate comments in Your altered macro
- where I should change how many columns I need to import from files,
- which column/columns I want to import from files
- macro should automatically import data from the whole of the selected column or columns of each text file into one single spread sheet and import it to different columns
I have found this:
Sub test()
Dim myDir As String, fn As String, ff As Integer, txt As String
Dim delim As String, n As Long, b(), flg As Boolean, x, t As Integer
myDir = "c: est" '
View 9 Replies
View Related
Dec 15, 2009
i am looking for a macro that would import chosen multiple text files and append them all into one worksheet into column B (one textfile row into one cell), with column A displaying the imported filename next to every entry.
View 5 Replies
View Related
Jan 23, 2010
I found the code below on the internet and adjusted it to my needs.It is working perfectly fine except for the fact that it opens a new workbook to import the data. I run this code from a workbook named "InstronImport.xlsm" and would like it to add the data in this workbook instead of a new one. I have been trying for a day now and can't seem to figure out how to do it.
Sub ImportRawFilesInstron()
Dim FilesToOpen
Dim x As Integer
Dim wkbAll As Workbook
Dim wkbTemp As Workbook
Dim sDelimiter As String
On Error Goto ErrHandler
Application. ScreenUpdating = False
sDelimiter = ","
FilesToOpen = Application. GetOpenFilename _
(FileFilter:="Text Files (*.raw), *.raw", _
MultiSelect:=True, Title:="Text Files to Open")...................
View 4 Replies
View Related
Oct 25, 2007
I am trying to convert multiple tab-separated text files into one worksheet. All the text files have the same format and file structure. I have been copying and pasting these files into an Excel spreadsheet but this is time consuming. I need to find out if anyone has any ideas on how to accomplish this task using a VBA macro.
View 3 Replies
View Related
Jan 4, 2008
Trying to import mutliple text files from one folder and save them into multiple tabs in the workbook. Found this piece of code on forums but can't respond to thread since its expired. Whenever i choose a file from the folder, it would say no files exist. Is there something wrong or am i missing libaries to run this?
Sub Test()
'First off, this will prompt where the text files are saved
filepath = Application. GetOpenFilename("Text Files (*.txt), *.txt", , "Where are your text files saved")
'this will strip the filename from your selection, leaving just the folder
Do While Right(filepath, 1) <> ""
filepath = Left(filepath, Len(filepath) - 1)
Loop
'This will search for all of the files within the folder
Set fs = Application.FileSearch
With fs...........................
View 3 Replies
View Related