Copy link to clipboard
Copied
I have an excel with filename in column A and keywords in column B. I wish to update the keywords tab in bridge using a script. Please let me know if there is any pre written script available which I can use.
Copy link to clipboard
Copied
If you save the Excel to CSV you could use. DIY Metadata
Another solution would be to use Exiftool ExifTool by Phil Harvey
Copy link to clipboard
Copied
Tried to use DIY Metadata but when it execute it I get an error message saying the file doesnt exist. Is it because of the format in which the data is stored in CSV file?
Copy link to clipboard
Copied
The filename should be in the first column I.E. filename.jpg and the file should exist in the selected folder or a sub folder if the relevant checkbox is ticked.
Copy link to clipboard
Copied
If you don’t use the Bridge script, then I can help with ExifTool (both methods have their pros/cons).
Copy link to clipboard
Copied
Hi Stephen. Thanks for the quick reply. I would be more than happy if you could guide me with Exiftool.
I have downloaded the tool. All I need is to now how to use it.
Link to the excel file:
Tanks in advance.
Copy link to clipboard
Copied
shashi88, are you on Mac or Windows OS?
The basic ExifTool commands are the same, however there are some minor formatting differences required in some cases, such as the Mac uses 'single quotes' to wrap around a file path and file name that contains word spaces, while on Windows, "double quotes" are used (they are not really quotes, they are inch and foot marks, straight not curly).
P.S. Are the images all in a single directory, or are they contained in a main parent/top-level folder and then within subsequent second-level, third-level etc nested folders?
Do you need to apply the keywords to a single specific file type, multiple file types or do you need to exclude specific file types?
Finally, are there existing keywords to be overwritten or do you wish to append?
Copy link to clipboard
Copied
I am on windows. As for the images, all are in a single parent directory plus the format is JPG.
Copy link to clipboard
Copied
DIY Metatada would not work for you as the file in not in the correct format, you do not have the filenames in the first column also your keywords would need to have a seperator of a semicolon not a comma.
Copy link to clipboard
Copied
I have tried to install in CS6 and CC, the startup script appears in a MetaData menu under “DIY Custom Metadata” – however I can’t get the script to work. I have tried selecting a file, a folder or nothing… however selecting the script does not do anything? User error I presume! :]
Copy link to clipboard
Copied
As an example csv, note double quotes are not used.
//////////////////////////////////
FileName,Keywords
filename.jpg,keyword1;keyword2,yet another keyword
filename2.jpg,key1;key2;key3
///////////////////////////////
To Use:-
Navigate to the folder where the files are.
D.I.Y Metadata
You would only tick Keyword 1
Select the CSV
Click Process
Thats all there is to it.
Copy link to clipboard
Copied
This script runs on Windows in CC (a GUI is generated), however I can’t get it to work on Mac El Capitan in either CS6 or CC (no GUI is generated)…
EDIT: This appears to be related to the font GEORGIA not being active, so either install/activate the font or change the font in the script into something available such as HELVETICA…
Copy link to clipboard
Copied
I believe fonts are a common problem on Macs
ScriptUI in Bridge is abysmal since CS5 so it does not surprise me that it didn't work.
Copy link to clipboard
Copied
Wow, thank you so much for the tip about the plugin not working due to the font Georgia missing. This was totally the case for me and I am beyond happy that I'm able to use this script again. Thank you!
Copy link to clipboard
Copied
You may wish to try DIY Metadata again adjusting your source .csv file as SuperMerlin noted…
______________
As ExifTool is command line interface based and not GUI, you may prefer to use the Bridge script option!
Before using ExifTool, one should backup all files first. By default ExifTool will create duplicate files, leaving the original files untouched but renamed for safety. So you may need at least double the free hard drive space available as the images being processed. If you have backed up your files, then you could skip the part where files are duplicated for safety.
I also recommend duping a small amount of files to a test directory, then testing that everything works in this test folder, before running on a large batch of images.
Just as there are specific file input requirements for the DIY Metadata script, ExifTool also has requirements of how import data should be formatted…
Firstly, let’s use ExifTool to recursively export the source filename and file system path and the keywords to CSV, in order to ascertain what format is required for the input CSV file (the example below is using Windows OS formatting). I created a test folder and sub-folder with files that were keyworded in order to “reverse engineer” the required info.
Run the Windows Command Prompt and enter the following data (be careful of copy/paste as it can change characters such as straight inch to curly double quote marks). Note that ‘Currentuser’ needs to be replaced with the username of Windows account user that is currently logged in (I have syntax highlighted the CLI code below to help break it up visually into it’s components):
exiftool -csv -r -subject "C:\Users\Currentuser\Desktop\test" > "C:\Users\Currentuser\Desktop\test\meta out.csv"
ExifTool will recursively scan the images found in the desktop folder titled ‘test’ Which returns a .csv file titled ‘meta out.csv’ inside the folder ‘test’ on the desktop of the current logged in user.
The contents of the ‘meta out.csv’ file reads as:
SourceFile,Subject
C:/Users/Currentuser/Desktop/test/META 1.jpg,"keyword1, keyword-A"
C:/Users/Currentuser/Desktop/test/META-2.jpg,keyword2
C:/Users/Currentuser/Desktop/test/sub_folder/META_3.jpg,subject3
What does this mean in relation to our input spreadsheet .CSV file?
We will now need to format our import file to suit these requirements. In your particular case, if “63679573” is the filename and the format is JPEG, you will need to add both the file path prefix and the file extension suffix to the name. If you need help in adding the file path prefix or the filename extension suffix of .jpg to your existing filenames, then it is easy enough to do so using a spreadsheet formula, or a regular expression capable text editor or even with textmechanic.com (the same is also true for enclosing your existing keywords with inch marks at the start/end).
If you need help with this text manipulation, let the forum know.
You can upload another sample file to dropbox when you have edited it if you like.
Let the forum know when you are ready to move onto the next stage of using ExifTool…
Copy link to clipboard
Copied
Before using ExifTool, one should backup all files first. By default ExifTool will create duplicate files, leaving the original files untouched but renamed for safety. So you may need at least double the free hard drive space available as the images being processed. If you have backed up your files, then you could skip the part where files are duplicated for safety.
I also recommend duping a small amount of files to a test directory, then testing that everything works in this test folder, before running on a large batch of images.
The following command will use the correctly formatted .CSV structure as mentioned in the previous PART A post to recursively update a folder/sub-folders of only JPEG files with the required keywords (backup copies of the original files will be created):
exiftool -sep ", " -r -csv="C:\Users\Currentuser\Desktop\Keyword Spreadsheet.csv" -ext jpg "C:\Users\Currentuser\Desktop\Folder Full of JPEG Files" -r
Adding the -overwrite_original_in_place switch will overwrite the originals without creation a backup (use with caution, ensure you have a backup of the files):
exiftool -sep ", " -r -csv="C:\Users\Currentuser\Desktop\Keyword Spreadsheet.csv" -ext jpg "C:\Users\Currentuser\Desktop\Folder Full of JPEG Files" -overwrite_original_in_place -r
Even though it has been stated that there is only a single top level folder with no sub-folders and that the folder only contains JPEG files, I have included the -r (recursively) and -ext jpg (only JPG extension files) command line switches in these examples.
Copy link to clipboard
Copied
A similar topic thread here:
Can you import metadata from an excel database to images (JPG, PSD, TIF) in bulk?