我需要在 Google 电子表格中的行或列上使用色标,例如 Microsoft Office 提供的色标 Excel conditional formatting with color scale :
我找不到可以完成这项工作的 Google Script Gallery 脚本。为所有可能的值手动设置条件格式不是解决方案。
我的能力仅限于编写正确的脚本。因此我想出了这个伪代码:
colorRangeFormatting(cellRange, minColorHex, maxColorHex)
{
float cellValueMax = getHighestValue(cellRange);
float cellValueMin = getLowestValue(cellRange);
int cellCount = range.length;
int colorValueMax = maxColorHex.toInt();
int colorValueMin = minColorHex.toInt();
int colorSize = colorValueMax - colorValueMin;
cellValueSize = cellValueMax - celLValueMin;
int colorIncrement = (colorSize/cellValueSize).Round();
int[] colorGradients = colorGradients[colorSize];
foreach(int color in colorGradients)
{
color = colorValueMin + colorIncrement;
colorIncrement = colorIncrement + colorIncrement;
}
int i = 0;
foreach(Cell c in cellRange)
{
c.setBackgroundColor(colorGradients[i].ToHex());
i++;
}
}
电子表格的谷歌应用程序脚本?
谢谢
最佳答案
关于google-apps-script - Google 电子表格中带有条件格式的色阶,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19637514/