Ok, I am a photographer and take team photos, where I write a unique ID to photos by using EXIF UserComment. The unique ID, is unique to the subject/person being photographed. So I can end up with many photos with a unique ID.
I then have an excel spreadsheet listing all of the Unique ID's with the metadata (headline, title and keywords) required to be written to each corresponding image.
For clarity this is a one to many relationship. One line of metadata to many photos.
Notes
- file names are not known
- I need to use the uniq ID as the key
Can ExifTool handle this?
Thank you in advance for your time and advice.
Exiftool's
-csv option (https://exiftool.org/exiftool_pod.html#csv-CSVFILE) requires a filename. Exiftool doesn't have an alternate way to read CSV files.
The best workaround I can think of is to
- Make a copy of your spreadsheet so it can be edited without affecting the original
- Get a list of all the UserComment and the matching filenames using the -csv option with this command
exiftool -csv -UserComment /path/to/files/ >temp.csv - Merge the two spreadsheets based upon the UserComment column. A quick search shows that Excel's "Consolidate" function would work for this.
- You could then add the data as normal with the -csv option
exiftool -csv=Merged.csv /path/to/files/
Do you want to do it one ID at a time?
Do you want to add the same headline, title and keywords for each unique ID?
Something like this to add a title for Unique ID 123:
exiftool -if '$UserComment eq "123"' -Title="This is a title" -overwrite_original .
(This is for MacOS - reverse single and double quotes for Windows)
If you want to automate it and run as batch you'd need a script.
Guys thank you, so much for the replies, extremely helpful.
Quote from: StarGeek on February 22, 2024, 11:18:07 AMExiftool's -csv option (https://exiftool.org/exiftool_pod.html#csv-CSVFILE) requires a filename. Exiftool doesn't have an alternate way to read CSV files.
The best workaround I can think of is to
- Make a copy of your spreadsheet so it can be edited without affecting the original
- Get a list of all the UserComment and the matching filenames using the -csv option with this command
exiftool -csv -UserComment /path/to/files/ >temp.csv - Merge the two spreadsheets based upon the UserComment column. A quick search shows that Excel's "Consolidate" function would work for this.
- You could then add the data as normal with the -csv option
exiftool -csv=Merged.csv /path/to/files/
Thank you for this. The consolidate didnt work but using Power Query I worked out a neat solution.
I then had a problem with the EXIF tags but I solved that and everything worked as it should - thank you.
Just one quick question, when it writes my csv file to the JPGs it goes ahead and duplicates the file creating a '..._original' file. Is there a way to prevent the duplication? If there is an error or something it is no issue as I can reexport the files - just a pain to delete the _original.
Quote from: BPAphoto on February 23, 2024, 12:58:57 AMJust one quick question, when it writes my csv file to the JPGs it goes ahead and duplicates the file creating a '..._original' file. Is there a way to prevent the duplication?
Use the
-overwrite_original option (https://exiftool.org/exiftool_pod.html#overwrite_original).
Quote from: StarGeek on February 23, 2024, 01:26:42 AMQuote from: BPAphoto on February 23, 2024, 12:58:57 AMJust one quick question, when it writes my csv file to the JPGs it goes ahead and duplicates the file creating a '..._original' file. Is there a way to prevent the duplication?
Use the -overwrite_original option (https://exiftool.org/exiftool_pod.html#overwrite_original).
Much appreciated!