I use the Metadata module to capture the filename (or parts of the file name) as metadata, by selecting “Extract from file/folder names” as the extraction method. Then " add image metadata columns to object data file" in the “ExportToSpreadsheet” module, but the file name doesn’t in the export sheet.
I expect this is happening because you’ve got multiple channels in your assay but the metadata values are different for each channel in the set. If the red channel has metadata of “First” and the green channel has “Second”, CellProfiler isn’t sure which to place in the output table and so tries to average them (which obviously doesn’t work). We might be able to address this in the next version, but for now a fix might be to only extract such metadata from the channel of interest rather than from all images.
Hope that helps.