简体   繁体   中英

Increment a concatenate formula with Google Script

I don't find a good solution to automatically increment a concatenate formula starting at row 2 and finishing at row 50.

I already managed to set the concatenate formula in the second row and 10th column with this.

var formula2 = 'CONCATENATE(C1;" - ";D1)'

sheet.getRange(2,10).setFormula(formula2)

How should I do now to increment it automatically from 2 to 50 in the E column?

How about the following modification?

From:

sheet.getRange(2,10).setFormula(formula2)

To:

sheet.getRange("E2:E50").setFormula(formula2);
  • If you want to put CONCATENATE(C2;" - ";D2) to the cell "E2", please modify var formula2 = 'CONCATENATE(C1;" - ";D1)' to var formula2 = 'CONCATENATE(C2;" - ";D2)' .

Reference:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM