What I am trying to do
Make a function in google sheets that will allow me to select a cell and enter "=rgbcolour", select 3 separate cells containing numbers between 0 and 255 to act as rgb values so that the cell that I entered "=rgbcolour" into will turn the appropriate colour as per the 3 separate rgb inputs
My Research
setBackGroundRGB not accepting string This person ran into the same error put his desired result, his methods used and the solution to his problem would not seem to apply
This setBackground() or setFontColor not working in GAS helped me try and figure out how to pass the cell, that the function would be entered into, into the setBackgroundRGB method. I ended up using
var cell = sheet.getActiveCell();
Although I may have been unsuccessful in this endeavour which may be contributing to my problemsI have been using https://developers.google.com/apps-script/guides/sheets/functions#using_a_custom_function as a guide
This is my code
function RGBCOLOUR(r,g,b)
{
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var cell = sheet.getActiveCell();
return cell.setBackgroundRGB(r,g,b);
}
this is my error
Cannot find method setBackgroundRGB((class),(class),(class)). (line 7, file "RGB Colour Cell")