Just ‘No’.
Files are designed to cut in a certain orientation. The files we use for saw chain are made for hand filing and not for the heat or speed that a powered drill would generate.
Could it work? Maybe. Is it a good idea? No. Are there better options? Yes.
As noted, there are a variety of rotary sharpening devices for chains that use abrasive grinding bits; Dremel, STIHL, Oregon, Granberg, etc.
There are guys who have posted here about sharpening with a 4 or 5 inch angle grinder, because it was all that they had. But in this case, you have a file! Use it!
One of my general rules for sharpening includes, “Lots of ways to sharpen; everyone has to find something that works for them“. So, if this works for you, knock yourself out. But it’s not something that I would encourage or recommend.
Philbert