Quantitative rule for reporting mean (SD) vs. Median (IQR)?

I see this question as more a matter of opinion and specific to the quantity or interest and what information you seek, however I thought some might have a pragmatic rule.

Essentially, I am writing a personal R script for generating descriptive tables to streamline my reports (like createTableOne, Stargazer etc.).

I wanted to write in a general rule for when the table should report mean (SD) or median (25th, 75th percentile) for numeric variables. Right now I have to specify for the function what I want, which is okay but I wanted to see if I could get fancier with it.

I was thinking about maybe some rule like so: if mean/median > 1.5 or <0.5 than report median (IQR).

A general rule of thumb for reporting mean or median as the defining measure of central tendency is a function of skewness. In a normally distributed distribution (with skew more or less between -1 and 1), the mean is the best measure of central tendency. With positively and negatively skewed distributions, however, median might be a better measure of central tendency. For the purposes of writing a function() (or a script, as you call it) to make your workflow more efficient, this rule of thumb might work for you. Altogether though, there is no overarching rule in this matter. Finally, I would argue for always reporting the mean over the median as it is the best measure of all participants' scores.