excel experts needed for advice?

Discussion in 'Programming' started by darrens, Jul 25, 2012.

  1. #1
    Guys,

    I have some exported data in 7 csv files.
    Each csv shares 1 common field called 'page_id'
    Any idea how i can merge the all of the csv files into one large csv based on 'page_id' ... ?

    Worth mentioning that in csv1 the page_id is a unique value but in the others there maybe duplicated for example:

    csv1
    page_id | title | date | content
    1,Page 1, 04/06/2012,<p>this is my content for page1</p>
    2,Page 2, 04/07/2012,<p>this is my content for page2</p>
    3,Page 3, 15/12/2012,<p>this is my content for page3</p>
    4,Page 4, 01/02/2013,<p>this is my content for page4</p>

    csv2
    page_id | image
    1,image1.jpg
    1,image1-1.jpg
    1,image1-2.jpg
    2,sun.jpg
    4,blahblah.jpg
    4,blahblah2.jpg

    So merging the above would make something like ...

    csv1
    page_id | title | date | content | image | image | image
    1,Page 1, 04/06/2012,<p>this is my content for page1</p>,image1.jpg,image1-1.jpg,image1-2.jpg
    2,Page 2, 04/07/2012,<p>this is my content for page2</p>,sun.jpg,
    3,Page 3, 15/12/2012,<p>this is my content for page3</p>,
    4,Page 4, 01/02/2013,<p>this is my content for page4</p>,blahblah.jpg,blahblah2.jpg

    Can anyone help? or even knock me up a simple php script to do it?

    Thanks
     
    darrens, Jul 25, 2012 IP