Estoy buscando copiar las celdas resaltadas en un color particular a la hoja diferente en una columna.
Documento de muestra: https://docs.google.com/spreadsheets/d/1Xa_WKlmHO5mT688zM0O-LXlqnSbITG2YK1uLPq5XzcA/edit#gid=328987545
¿Me pueden ayudar con el script para obtener el resultado deseado?
Creo que su objetivo es el siguiente.
#ffff00 ) y desea colocar los valores en la columna "A" de la hoja de destino.En este caso, ¿qué tal el siguiente script de muestra?
function myFunction() { const srcSheetName = "Sheet1"; // This is from your sample Spreadsheet. const dstSheetName = "Ouput"; // This is from your sample Spreadsheet. const checkColor = "#ffff00"; // This is from your sample Spreadsheet. // Retrieve sheets. const ss = SpreadsheetApp.getActiveSpreadsheet(); const [src, dst] = [srcSheetName, dstSheetName].map(s => ss.getSheetByName(s)); // Retrieve source values and backgrounds. const srcRange = src.getDataRange(); const backgrounds = srcRange.getBackgrounds(); // Create an array for putting to the destination sheet. const values = srcRange.getValues().reduce((ar, r, i) => { r.forEach((c, j) => { if (backgrounds[i][j] == checkColor) { ar.push([c]); } }); return ar; }, []); // Put the array to the column "A" of the destination sheet. dst.getRange(1, 1, values.length).setValues(values).setBackground(checkColor); }setBackground(checkColor) . Si no desea establecer el color, elimínelo.