MCPcopy Index your code
hub / github.com/analyticswithadam/App_Script / pullVariables

Function pullVariables

Data to Narrative with Input.js:9–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7}
8
9function pullVariables() {
10 var ss = SpreadsheetApp.getActiveSpreadsheet();
11 var sheet = ss.getSheetByName("Input");
12
13 if (!sheet) {
14 throw new Error("Sheet 'Input' not found");
15 }
16
17 var values = sheet.getRange("C5:C9").getValues().flat();
18 var validationRange = sheet.getRange("E5:E9");
19
20 var validationValues = [];
21 var validationBackgrounds = [];
22 var errorMessage = "";
23
24 for (var i = 0; i < 5; i++) {
25 if (values[i]) {
26 validationValues.push(["Valid input provided"]);
27 validationBackgrounds.push(["#b6d7a8"]); // Light green
28 } else {
29 validationValues.push(["Error: Input not provided"]);
30 validationBackgrounds.push(["#ea9999"]); // Light red
31 errorMessage += `Input Field ${i + 1} is empty. `;
32 }
33 }
34
35 validationRange.setValues(validationValues);
36 validationRange.setBackgrounds(validationBackgrounds);
37
38 if (errorMessage) {
39 throw new Error(errorMessage);
40 }
41
42 return {
43 var1: values[0],
44 var2: values[1],
45 var3: values[2],
46 var4: values[3],
47 var5: values[4]
48 };
49}
50
51
52function fetchBigQueryData() {

Callers 2

fetchBigQueryDataFunction · 0.70
formatReportFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected