A formula in a table then in a sheet does not work

16 views
Skip to first unread message

CHARLIE BOUVIER

unread,
Nov 22, 2022, 4:01:38 AM11/22/22
to Google Apps Script Community
Dear all, 

I would like to add a formula in a range to add it in a sheet.
But at the moment I have a problem, it does not work:

function testlienbzv() 
let ss = SpreadsheetApp.openById('xxx);
let tbd = ss.getSheetByName('yyy');
let range = tbd.getRange(1,1,5,5);
let values = range.getValues();
values[3][3]="=RECHERCHEV(C4;'point bzv'!C:C;1;FAUX())";
range.setValues(values);
}
Is does this error:
ttt.png


What I would like to do is a VLOOKUP in the table which find the value at column 3, line x to the sheet point bzv. Can someone Help me?
 
Thanks a lot,
Charlie.

Martin Molloy

unread,
Nov 22, 2022, 5:43:03 AM11/22/22
to google-apps-sc...@googlegroups.com
To set a formula in a cell you should use the setFormula() command (or setFormulas() for a range of cells)

so try
var cell = sheet.getRange("D4");
cell
.setFormula("=RECHERCHEV(C4;'point bzv'!C:C;1;FAUX())");
 


--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/634eb907-809e-4e1a-b4c0-6f59c639f86bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages