Build range with string

前端 未结 1 1128
孤街浪徒
孤街浪徒 2021-01-28 17:52

I have this statement:

var destinationRange = destinationSheet.getRange("D26:E39");

and want to replace it with

var dest         


        
1条回答
  •  南方客
    南方客 (楼主)
    2021-01-28 18:46

    You can use Template literals to accomplish this task:

    const dValue = 26;
    const eValue = dValue + 13;
    const daGrowaRange = `D${dValue}:E${eValue}`;
    const destinationRange = destinationSheet.getRange(daGrowaRange);
    

    0 讨论(0)
提交回复
热议问题