=CHECKSTYLE(A1, "italic")
function CHECKSTYLE(range, styleElement) {
var arr = [],
ret;
var styleEl = ["line-through", "underline", "italic", "bold"]
var range = SpreadsheetApp.getActiveSheet()
.getRange(range);
var styles;
if (styleEl.indexOf(styleElement) == 2) {
styles = range.getFontStyles()
} else if (styleEl.indexOf(styleElement) == 3) {
styles = range.getFontWeights()
} else if (styleEl.indexOf(styleElement) != -1) {
styles = range.getFontLines();
} else {
throw "the 2nd parameter can only be " + styleEl.toString()
.replace(",", ", ")
}
styles.reduce(function (a, b) {
return a.concat(b);
})
.forEach(function (el) {
el === styleElement ? arr.push(["TRUE"]) : arr.push(["FALSE"])
});
range.getNumRows() == 1 ? ret = transpose(arr) : ret = arr;
return ret;
}