2012-11-06 8 views

risposta

0

Cattive notizie, temo. Ho appena passato un'ora a cercare la stessa risposta da solo, e non credo che ce ne sia una!

1

Io uso il comando:

sheet.getRange(1,1,maxrows,maxcolumns).setBorder(true,true,true,true,false,false,"white"); 

Questo cambiamento della LineColor per il bianco, che è lo stesso dello sfondo. Quindi, la griglia è "nascosta". Questo funziona per me.

+0

Questa funzione è migliore. function hideGridline (foglio, righe, colonne) { per (var i = 1; i <= rows; i ++) per (var j = 1; j <= cols; j ++) sheet.getRange (i, j). setBorder (true, true, true, true, false, false, "white", SpreadsheetApp.BorderStyle.SOLID); } – tbernardes

1

Un po 'in ritardo, ma ecco un utile snippet per ottenere ciò chiamando l'API V4 da Google Apps Script.

per questo lavoro:

  • È necessario abilitare i fogli API v4 nel vostro Google Cloud Console per il progetto Google Apps Script rilegato del foglio, che si può raggiungere da dentro l'editor di script , da risorse-> progetto cloud Platform ...

  • È probabile che anche necessario attivare le schede V4 API risorse-> servizi avanzati di Google ...

function test() { 
    var spreadsheetId = SpreadsheetApp.getActive().getId(); 
    var sheetId = SpreadsheetApp.getActiveSheet().getSheetId(); 
    hideGridlines(spreadsheetId, sheetId, false); 
} 

/** 
* Hide or show gridlines 
* 
* @param {string} spreadsheetId - The spreadsheet to request. 
* @param {number} sheetId - The ID of the sheet. 
* @param {boolean} hideGridlines - True if the grid shouldn't show gridlines in the UI. 
**/ 
function hideGridlines(spreadsheetId, sheetId, hideGridlines) { 
    var resource = { 
    "requests": [ 
     { 
     "updateSheetProperties": { 
      "fields": "gridProperties(hideGridlines)",  
      "properties": { 
      "sheetId": sheetId, 
      "gridProperties": { 
       "hideGridlines": hideGridlines 
      } 
      } 
     } 
     } 
    ], 
    "includeSpreadsheetInResponse": false, 
    "responseIncludeGridData": false, 
    } 

    Sheets.Spreadsheets.batchUpdate(resource, spreadsheetId) 
} 
+0

Grazie! Questo mi ha fatto risparmiare un sacco di tempo! –

Problemi correlati