I have need to write metadata from an Excel spreadsheet (or CSV file) one at a time after capture to a TIFF file based on the filename, which will be a column in the spreadsheet. I know EXIFTool can do this in bulk but how about a script or command to look in the CSV for the filename indicated copy and paste this in a popup the script uses or point at the file itself first) and then write specified column values to specified IPTC fields for that file. Thanks in advance!!
ExifTool will look in the CSV file for the row with the specified file name (matching the "SourceFile" entry in the first column). The only trick then is getting the name of the file you want updated onto the exiftool command line. I can't help with that.
- Phil
Figured out how to get name of the file and pass it on as such:
/usr/local/bin/exiftool -csv=/Users/account_name/Desktop/metadata.csv " & pathName
How do I specify the columns I want from the CSV and the IPTC fields I want to write the data to in the argument?
Thanks again!
Currently all of the columns get written.
- Phil
You could use something like CSVKit (https://csvkit.readthedocs.io/en/1.0.2/) to slice out the columns you want.
I haven't tested this, but I would think the command would be something like this:
"exiftool -csv=- " & pathName & " | csvcut -c SourceFile,Caption-Abstract,Keywords /Users/account_name/Desktop/metadata.csv"
In this case, csvcut would keep only the columns you wanted and pipe them through to exiftool. -csv=- would then read from the piped data.
Thank you. I can probably have the CSV file already prepped just with the columns I want. Where would they get written; can I control what IPTC fields, for example, they get written to?
They get written to the tag specified in the csv column header.
- Phil