我在GAS editor中执行过滤的代码行:-
var forhtmlemail=HtmlService.createTemplateFromFile("mycurrencyitem");
forhtmlemail.tableRangeValues = tableRangeValues.filter(([,b]) => b.toString()!=0 && b.toString()!='0' && b.toString()!='' && b.toString()!='RM - ' && b.toString()!='-');
我的此表的html代码:-
<tbody style="border-style: none solid solid;border-color: #3E1176">
<?tableRangeValues.forEach((r,i)=>{
let color;
if(i%2===0){color="white"}else{color="#F6EFFE"}?>
<tr style="border-style: none solid;border-color:#3E1176;padding:10px;color:#3E1176;font-size:10pt;background-color:<?=color?>;">
<td style="width: 3.77781%; height: 16px;"></td>
<td style="width: 52.7272%;" colspan="2"><?=r[0]?></td>
<td style="width: 36.0039%;" colspan="2"><?=r[1]?></td>
<td style="width: 7.49131%; height: 16px;">
</td>
</tr>
<?})?>
</tbody>
您尝试过javascript中的tofixed
函数吗?
(19085.57).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,'); // 19,085.57