()
| 11 | } |
| 12 | |
| 13 | function applyCompanyStyle() { |
| 14 | // Get the active spreadsheet and sheet |
| 15 | const spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); |
| 16 | const sheet = spreadsheet.getActiveSheet(); |
| 17 | |
| 18 | // Get the last row and column to dynamically select the data range |
| 19 | const lastRow = sheet.getLastRow(); |
| 20 | const lastColumn = sheet.getLastColumn(); |
| 21 | |
| 22 | // Define the header range (assuming headers are in the first row) |
| 23 | const headerRange = sheet.getRange(1, 1, 1, lastColumn); |
| 24 | |
| 25 | // Apply header formatting |
| 26 | headerRange.setBackground('#e0e0e0'); // Light gray background |
| 27 | headerRange.setFontWeight('bold'); |
| 28 | headerRange.setFontFamily('Roboto'); |
| 29 | headerRange.setFontColor('#333333'); // Dark gray text |
| 30 | headerRange.setHorizontalAlignment('left'); |
| 31 | |
| 32 | // Define the data range (excluding headers) |
| 33 | const dataRange = sheet.getRange(2, 1, lastRow - 1, lastColumn); |
| 34 | |
| 35 | // Apply data formatting |
| 36 | dataRange.setFontFamily('Roboto'); |
| 37 | dataRange.setFontColor('#555555'); // Medium gray text |
| 38 | dataRange.setBackground('white'); |
| 39 | |
| 40 | // Example of formatting a specific column (e.g., Sales column) |
| 41 | const salesColumnIndex = 5; // Assuming "Sales" is the 3rd column |
| 42 | const salesColumnRange = sheet.getRange(2, salesColumnIndex, lastRow - 1, 1); |
| 43 | salesColumnRange.setNumberFormat('$#,##0.0'); // Currency format |
| 44 | |
| 45 | // Auto-resize columns for better readability |
| 46 | sheet.autoResizeColumns(1, lastColumn); |
| 47 | |
| 48 | Logger.log('Google style formatting applied!'); |
| 49 | } |
| 50 | |
| 51 | function applyMcDonaldsStyle() { |
| 52 | // Get the active spreadsheet and sheet |
nothing calls this directly
no outgoing calls
no test coverage detected