Reputation: 149
I have a formula as follows to be included in Google sheet
paypalPayment.getRange("A2").setFormula('=FILTER(USERNAMES!I:I, VALUE(REGEXEXTRACT(B4, "(\d+)")) = USERNAMES!B:B, "JALAN SANGGUL " & REGEXEXTRACT(B4, "\d{1,3}.+(\d)") = USERNAMES!C:C)');
If I use this formula in google sheet, there is no problem, the formula is working fine but when I use it in google app script the \d becomes d automatically in google sheets, I am not sure with the problem but can anyone help me with it?
Upvotes: 0
Views: 131
Reputation: 2699
Try this, in Javascrip language, \ is consider as escape function, in order for your scrip tto write value start with \ correctly, you need to escape , therefore the answer is \d
paypalPayment.getRange("A2").setFormula('=FILTER(USERNAMES!I:I, VALUE(REGEXEXTRACT(B4, "(\\d+)")) = USERNAMES!B:B, "JALAN SANGGUL " & REGEXEXTRACT(B4, "\\d{1,3}.+(\\d)") = USERNAMES!C:C)')
Upvotes: 1