Connect query for IDR logs with large results size as attachment

Part of my incident response workflow retrieves firewall logs matching malicious IP addresses from IDR.
When the result size is too large, the workflow returns a text file instead of an array.
How can I setup my workflow to handle that scenario and attach the file to a Teams conversation?