Merge pdf files using information from two files

accessnewbie at gmail.com accessnewbie at gmail.com
Fri Sep 8 16:21:20 EDT 2017


I have two files (right now they are spreadsheets but I can export them to any format). 

File1 has StoreID (unique) in one column and a pdf map location in the second column. (Names not really sequenced numerically)

1     C:/maps/map1.pdf
2     C:/maps/map2.pdf
3     C:/maps/map3.pdf
4     C:/maps/map4.pdf

File2 has 3 columns. Column1 is the County name (unique), Column2 are the store IDs that fall in that county separated by commas, and Column3 is warehouse that services the store.

County1    1,2    Warehouse1
County2    1,3    Warehouse1
County3    3      Warehouse4
County4    2,4    Warehouse3

Is it possible to compare both files and append the maps that belong in each county and naming it by the county_warehouse.pdf?

Output would be something like this:

C:\maps\final\County1_Warehouse1.pdf (pdf file is map1.pdf and map2.pdf)
C:\maps\final\County2_Warehouse1.pdf (pdf file is map1.pdf and map3.pdf)
C:\maps\final\County3_Warehouse4.pdf (pdf file is map3.pdf)
C:\maps\final\County4_Warehouse1.pdf (pdf file is map2.pdf and map4.pdf)

I could spend some time reorganizing the second file to look like this if it makes it easier:

County1    1    Warehouse1
County1    2    Warehouse1
County2    1    Warehouse1
County2    3    Warehouse1
County3    3    Warehouse4
County4    2    Warehouse3
County4    4    Warehouse3

Ideas as to how to accomplish this?



More information about the Python-list mailing list