Fitting merged text to the width of the frame in InDesign
I have a document with several text frames with content merged from a CSV. Sometimes the content is too big for the frame. I want the text to scale appropriately so that the content remains on one line and fits in the frame width-wise. I don't want the frame to resize. Is this possible?
Perhaps ironically, that happens automatically if you insert a variable in a text frame (because a variable is really just a single hidden character under the hood). Things don't work that way with merged data.
From your question, it sounds like you're getting overset text after a data merge and you want to solve this by reducing the point size of the text automatically. That's not a function that exists natively in InDesign, because there are almost no circumstances when it would be useful. (I don't want anything automatically changing the point size of my type without asking!) It could be scripted, but I don't know of an existing script off-hand that does this.
If the amount of text that gets overset is small, and you don't mind a bit of glyph scaling, set the Paragraph Style for that field to Full Justify, then get brutal in the Justification settings:
Short text will look a bit stretched out, and longer text will definitely look scrunched, but if the appearance isn't important (and it seems that it's not, in this case) this could be an automated solution to your problem.
----- EDIT --------
Your comment gives me a clearer idea of what you're trying to do, so I need to add to this answer.
Name tags (or any other highly visible signage/label system) have to be uniform. There's a very restricted range within which you can alter text formatting before the variations look obvious, ugly and inept.
In this situation, rather than produce something that's going to be very publicly horrible-looking, your better bet is to modify the design of the tag so that all names fit in the available space, or at least the overset names are down to a very small number:
Use a more condensed font.
Reduce the point size a bit, in addition to using a more condensed font.
Enlarge the text frame and adjust leading so that longer names can break onto two lines. (With all caps text, you can use heavy negative leading without reducing legibility or looking odd. Turn off hyphenation, obviously!)