I set formula in sheet1 cell (1,9) to get the value from other sheet through google apps script. Where "sheet" is a variable, I need to get value from specific sheets. The code below shows "=sheet!B1" rather than "=6!B1".
var ss1 = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/xxxxxxxxxxxxxxxxxxxx/edit#gid=0");
var sheet1 = ss1.getSheetByName("Sheet1");
var sheet;
sheet = 6;
var sheet = sheet.toString();
sheet1.getRange(1,9).setFormula('sheet!B1')
}