Thank you, Bluefrog. All working, and I have learned a lot.
One query. I have one former metadata field (‘key’) which I no longer need, but which keeps reappearing when I do an import. I have tried both unchecking it in the custom metadata list, and deleting it from the list; there is no longer a column with that heading in the .csv, and it doesn’t appear in the AppleScript. Is there a way of preventing it from reappearing?