如何“清除格式”在Google表格通过应用程序脚本 [英] How to "Clear Format" in Google Sheets via Apps Script

查看:170
本文介绍了如何“清除格式”在Google表格通过应用程序脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Google表格中,我现在通过手动删除格式>清除格式化

In my Google Sheet, I currently remove formatting by manually going to Format > Clear Formatting.

如何以编程方式(通过Apps脚本)清除Google表格行中可能存在的任何格式/和/或列?

How can I programmatically (via Apps Script) clear any/all formatting that may exist in a Google Sheet's row(s) and/or column(s)?

澄清:我知道格式>相同的操作清除格式在主菜单中可用的函数。

Clarification: I am aware of the Text Class that has formatting functions (eg. setForegroundColor(), setItalic(), setTextAlignment(), etc), but I'm not aware of any single function that will do the same thing as the Format > Clear Formatting function that is available in the Main Menu.

推荐答案



Example from the docs:

// This example assumes there is a sheet named "first"
 var ss = SpreadsheetApp.getActiveSpreadsheet();
 var first = ss.getSheetByName("first");
 first.clearFormats();

这篇关于如何“清除格式”在Google表格通过应用程序脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆