automatically import data from CSV to excel/calc sheet - excel

I have here 12 CSV source file (just numbers separated with semicolon).
I need on one action/click take this data and import it to excel/calc to 12 sheets (1 sheet for 1 csv source).
Any Idea how can I do that?

you can do it with Excel vba:
create a new workbook (or use the current one depending on your needs)
ask the user to select several csv files (if they are on the same folder, else, you can ask the user if he still have some more to import) >> doc here
copy or move the imported worksheet to the new or current workbook (>> Excel 2003 VBA: Move a sheet into a new workbook that is referenced by a variable)
Please let us know if you encounter some trouble building your procedure

By using the code in this post combined with a loop in which you step through the filenames (which you could keep in an array of string) and vary the .Destination with the sheets in the workbook(you can step through them by making as many new sheets as you need in the workbook and then going from Sheets(1) through Sheets(N), where N is the number of sheets.

Related

How to Find and Open in a Dir () loop specific Workbook in a folder and specific worksheet and copy the range to new Workbook via VBA

This my first post in this forum, and I am newbie to VBA. I thought to ask you whether you might have some ideas how to do the following task I am trying to accomplish in VBA:
I have more than 600 workbooks in a folder containing multiple spreadsheets. Each of spreadsheets contains some sort of data which I need to access their range and copy to new workbooks.
From sheets stored in one workbook for example I only need one, which is predominantly stored at Sheets index position 1, although in more than 100 workbook that is not the case. I already looped through all files in folder with Dir() function and know which workbooks do have sheets that I need on wrong index position. I need also to copy a range of that specific sheet to another workbook, which I am able to do but how to use VBA to find dynamically workbook I need and sheet by its index position. I really want to avoid opening workbooks via Dir function in a loop and do work manually.
How can I dynamically use an array or any other method and find those workbooks and sheets within workbooks that I am interested and either flag them through Boolean If statement and either have msg box pop out saying: “This sheet needs work”, or just copy the range to new workbook and save it along with the remainder of workbooks in a folder.
Any ideas or help would be much appreciated.
Many thanks

How to automate updating an Excel sheet from a folder in Dropbox?

My requirement is as outlined below:
a) i will be generating a CSV and I will be placing it in a shared Dropbox folder everyday at a set time on one PC.
b) I need MS Excel to check the same Dropbox folder on another PC for a new CSV everyday at the same time and update the corresponding column in the sheet with the contents of the CSV.
c) An example of this is let each column in the Excel represent a day in the month. THen each CSV would have the data for a day and I would like the script to append to the sheet as each day progresses in the month.
Kindly give pointers as to how I should be going about doing this. If in need of further clarification on above requirements, do let me know.
Thank you in advance for your time and contributions.
You need to use the Workbooks.Open method to open the CSV and your destination workbook. Consider assigning them to variables, like wbSource As Workbook and wbDest as Workbook.
Then you need the Range.Copy method to copy the data from the CSV.
If you want to find the next available column to put the data, that will require the Range.End property. Something like Cells(1,1000).End(xlToLeft).Offset(0,1).
Finally, you'll need the Range.PasteSpecial method to put the data on the destination sheet. Use xlPasteAll if you want to do a regular copy and paste. You could use the Worksheet.Paste method, but that requires that you select the proper cell and that's just not desirable.

Make excel worksheet mirror worksheet in external file

How can I make a worksheet in my excel file mirror exactly the sheet of a different (closed) worksheet.
Basically, I have around 5 files with a lot of data the gets consolidated into a single dashboard with the important information. I then want to create a file (lets call it report) that has the 'main' sheet from each of these different files.
Ideally, the report file will not have to be altered, and when it is opened it will already have all the data needed.
Note: there are merged cells in the documents that are in variable positions.
response to comment #1:
By be there already, for example you can do a vlookup referencing other workbooks.. and the values of those vlookups will be correct when you open the file. First I thought I could just say cell A1 is file 1 = cell A1 in file 2, but the merged cells throw that off because it will not create merged cells to match
I found the following and it can be done in Excel VBA.
1) open consolidated workbook
2) Assuming that all the files you need to consolidate are in a given directory, you can obtain the list of all these files.
2.1) Traverse the list of files and open them one after the other
2.2) When a file is open, you might want to change the name of the sheet before moving it to the "report" file.
2.3) Close each file without saving them.

from a xlsx file that contains links / references to xls raw data file

I want to save my xlsx file that contains links to other worksheets, to a xls format that contains raw output without formulas..
Would
Select all, Copy, Paste Values
Do it?
Agree with Jaydee if the worksheets are in the same workbook - but remember to save as XLS first or you might accidentally lose the formula if you were intending to keep them in XLSX.
For multiple worksheets too. Simply click on the tab of the first worksheet, then the final worksheet while holding down the shift key. You can then select all on the first worksheet and it will automatically do the same for every other worksheet.
If you have links to worksheets in other workbooks (Excel files) use save as XLS then Edit Links & Break Links (data tab) will do the trick.

How to copy data from another workbook and paste onto related group rows?

How do I copy data from all the workbooks in the folder onto workbook 1 into it's corresponding row groups?
The attached images shows the sample worksheet is the file I want to paste data into (main template) and wb2 sample is a sample of one of the worksheets in the folder that I want to copy data from.
As you can see, the workbook 2 does not include all of the tasks. So I need to copy all of the data from workbook 2 and paste it on the corresponding row group (col A) on original workbook. I then need to do this for all workbooks in the folder.
Any help would be most appreciated!
To get the list of files, you will need to modify the code provided in this answer:
http://www.ozgrid.com/forum/showthread.php?t=65530
(you will need to read some documentation to select only xls files)
To open each of those files, read the documenation on opening files. This url can get you started:
http://p2p.wrox.com/excel-vba/10510-opening-excel-file-vba.html
After that, you will need to copy data from one workbook to another. See this url:
http://www.ozgrid.com/forum/showthread.php?t=18728
I know this isn't a very complete answer, but your question isn't terribly clear.

Resources