I know that this kanji is associated with writing and text, and can mean "sentence." When using it to mean "sentence", is it only a written sentence? I can't find any examples that unambiguously demonstrate that it can be a spoken sentence as well.
文 refers to a sentence, regardless of whether it's written or spoken. I find no significant discrepancy in usage between Japanese '文' and English 'sentence' here.
For example you can say something like 命令文のイントネーション (intonation of an imperative sentence), which unequivocally refers to a spoken sentence.