MCPcopy Create free account
hub / github.com/analyticswithadam/App_Script / applyMcDonaldsStyle

Function applyMcDonaldsStyle

Formatting.js:51–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49}
50
51 function applyMcDonaldsStyle() {
52 // Get the active spreadsheet and sheet
53 const spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
54 const sheet = spreadsheet.getActiveSheet();
55
56 // Get the last row and column
57 const lastRow = sheet.getLastRow();
58 const lastColumn = sheet.getLastColumn();
59
60 // Define the header range
61 const headerRange = sheet.getRange(1, 1, 1, lastColumn);
62
63 // Apply header formatting
64 headerRange.setBackground('#FFC72C'); // McDonald's Yellow
65 headerRange.setFontWeight('bold');
66 headerRange.setFontFamily('Arial'); // A commonly available bold font
67 headerRange.setFontColor('#D9001B'); // McDonald's Red
68 headerRange.setHorizontalAlignment('center');
69
70 // Apply red alternating row background for data
71 for (let i = 2; i <= lastRow; i++) {
72 const rowRange = sheet.getRange(i, 1, 1, lastColumn);
73 if (i % 2 === 0) { // Even rows
74 rowRange.setBackground('#FFE0B2'); // Lighter Yellow
75 } else { // Odd rows
76 rowRange.setBackground('#FFF3E0'); // Very light orange/beige
77 }
78 rowRange.setFontFamily('Arial');
79 rowRange.setFontColor('#000000'); // Black text
80 }
81
82 // Example of formatting a specific column (e.g., Sales column)
83 const salesColumnIndex = 5; // Assuming "Sales" is the 3rd column
84 const salesColumnRange = sheet.getRange(2, salesColumnIndex, lastRow - 1, 1);
85 salesColumnRange.setNumberFormat('$#,##0'); // Currency format
86
87 // Auto-resize columns
88 sheet.autoResizeColumns(1, lastColumn);
89
90 Logger.log('McDonald\'s style formatting applied!');
91}
92
93function applyCocaColaStyle() {
94 // Get the active spreadsheet and sheet

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected