Merge two table from different csv files

Soly_90

New Member
Joined
Sep 4, 2024
Messages
22
Office Version
  1. 365
Platform
  1. Windows
Hello ,
I am still beginner in using macro vba and I need a help .
I have two different csv file .
I want the user to enter the path file of the csv file to use as input in the script
This csv file has only one sheet called data ,that include one table with different columns .

The second csv file contains sheet called source
,include only one table .

I want to merge this table from first csv file with the table from the second csv file .

(first csv file (user input ) contains always column called target and the second csv file contains also target column )
Both of them has target column name
I need only to merge the rows that contains same value in target column and ignore the rest rows .


I would like to have like window ,that allow user to enter the file path of excel file and also the user enter folder path of csv file
And button to run the script

Could you help me ?
Thanks in advance
 
I personally try to avoid macros as much as possible. IMO they are powerful but in most cases avoidable and can be replaced with formulas. To build forms for data input they are very good. But in my normal work I don't need them. I think they are good when you have to build a workbook for others to use and you want to make it as simple to use as possible for them. And avoid wrong data entrys. But I think in most cases if you need something like that you have different and better options than excel.

Power query is very good at importing (from a lot of different sources) and transforming lots of data. Take your request. With power query it was pretty easy and fast to get the end result. If you would have done it with macros it would have taken your a lot more time. (some macros specialist may disagree, but for the average user i think power query is the faster option).
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I personally try to avoid macros as much as possible. IMO they are powerful but in most cases avoidable and can be replaced with formulas. To build forms for data input they are very good. But in my normal work I don't need them. I think they are good when you have to build a workbook for others to use and you want to make it as simple to use as possible for them. And avoid wrong data entrys. But I think in most cases if you need something like that you have different and better options than excel.

Power query is very good at importing (from a lot of different sources) and transforming lots of data. Take your request. With power query it was pretty easy and fast to get the end result. If you would have done it with macros it would have taken your a lot more time. (some macros specialist may disagree, but for the average user i think power query is the faster option).
Thanks for ur reply .
Could I create a button to save the results sheet after clicking refresh all , so it will be easy for user to save quickly the file ?

Or is there a way to let the results sheet to save Automatically as csv file in specific folder ?

Iam sorry if I ask a lot
 
Upvote 0
Save the file as xlsx file first. And then save as csv file, from the "save as" menu.
 
Upvote 0
Save the file as xlsx file first. And then save as csv file, from the "save as" menu.
thanks for ur solution .
I am struggling that I would like to create a button to save the output sheet of power query as csv files .
it should be automatic .
I have tried different script but it does not work .
Do you have vba macro code for saving the output sheet of power query ?
Thanks for help
 
Upvote 0
I would like to creat macro code
The path folder name and file name depend on specified cells .
How could I save the output table as csv ,depend on specified cells ?
 
Upvote 0

Forum statistics

Threads
1,223,838
Messages
6,174,940
Members
452,593
Latest member
Jason5710

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top