Append rows into different csv files based on column value

number15

New Member
Joined
May 7, 2022
Messages
18
Office Version
  1. 365
Platform
  1. Windows
Hi,
I'm looking for a solution for this case scenario.

I have an excel file with in a column some names and some csv files, named with same names.
I'm trying a way to extract the rows from the excel file and append them to the proper csv file.

For example, Excel file:

Name,Col2,Col3,Col4
Pippo,x,x,x
Pippo,y,y,y
Pippo,z,z,z
Pluto,a,f,b
Pluto,a,g,b

And following csv files:
Pippo.csv
Col2,Col3,Col4
a,b,f
x,b,v

Pluto.csv
Col2,Col3,Col4
y,s,b
y,s,g

Result should be
Pippo.csv
Col2,Col3,Col4
a,b,f
x,b,v
x,x,x
y,y,y
z,z,z

Pluto.csv
Col2,Col3,Col4
y,s,b
y,s,g
a,f,b
a,g,b

My knowledge of VBA is 0, but I can try to work on it if it's possible to solve this case.
I'm fine also to buy an add-in if exists.

Thanks
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
So if you run it on Test file, you see the accent correctly in the new row?

This is how it appears to me

aWLAcSf.jpeg


Ps. I use ";" as csv separator
 
Upvote 0
I use "," as csv separator. But that doesn't affect the storage in the text file.

This is how it appears to me:

1658784792341.png


If you get a chance, try another computer.
 
Upvote 0
I did nothing, but like after shutdown everything it's working properly.
Mystery.

Thank you very much! 🍻
 
Upvote 0
I've another request: is there a way to update just some cells value, if the row identifier is already existing?

Existing rows in csv
id,field2,field3
1,pippo,pluto
2,abcd,audhs

Rows to be edited
1,dumbo

Final csv
1,dumbo,pluto
2,abcd,audhs

If it's possible, we need to think how we could integrate it in our flow.
We could have two options:
1) same macro, appending or uploading rows depending if the id already existing or not in the destination csv
2) two different macros, one for appending and one for updating

How is it possible to do with VBA?
Both options are feasible?
Thanks
 
Upvote 0

Forum statistics

Threads
1,215,454
Messages
6,124,932
Members
449,195
Latest member
Stevenciu

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