Skip to main content

Bom dia, Boa Tarde, Boa Noite queridos Blippers, bão demais?



Hoje é meu aniversário hahaha mas eu preparei um presente para vocês que são parte tão especial da minha vida. 😍



Fim de ano é uma época complicada né? Cada empresa acaba lidando com os feriados de uma maneira diferente e às vezes quem vai definir isso não é a mesma pessoa responsável pela plataforma, certo? Mas e se a gente fizesse igual o esquema da horas por planilha? Um feriado por planilha? Então cola comigo e vem fazer mágica!



Primeiro você vai precisar fazer uma cópia desta planilha aqui: Feriados Teste - Google Sheets





💡 Ela é bem intuitiva e fácil de preencher, lembrando que 0 é um dia comum e 1 um dia que você vai tratar como feriado.



Agora vamos fazer como no tutorial de horários, e dar acesso ao email que vai fazer a integração para nós como editor, o email é esse aqui: [email protected]





Feito isso, vamos fazer uma requisição do tipo GET no seguinte URL: https://googlesheets.cs.blip.ai/sheets/cod_da_sua_planilha/0?field=meses&value=



💡 Lembrando que o código da planilha é que fica entre as barras no meio da URL dela:





No meu caso 1thx1kIxSz8MYLesTaByRjdAvzhxgKEbKxBv9jdSnRMs, logo o URL ficaria https://googlesheets.cs.blip.ai/sheets/1thx1kIxSz8MYLesTaByRjdAvzhxgKEbKxBv9jdSnRMs/0?field=meses&value=



Feito isso, vamos salvar o status e o retorno da requisição:





Feito isso vamos usar um script para testar se hoje é feriado, que vai será:



    function run(json){



response = JSON.parse(json)



/* system date */



let data = new Date()



let isHoliday = new Boolean()



/* object with local date and time */



var currentDate = {



year : data.getFullYear(), /* The getFullYear() method returns the year (four digits for dates between year 1000 and 9999) of the specified date.*/



month : data.getMonth(), /* The getMonth() method returns the month (from 0 to 11) for the specified date, according to local time. */



day : data.getDate(), /* The getDate() method returns the day of the month (from 1 to 31) for the specified date. */



day_week : data.getDay(), /* The getDay() method returns the day of the week (from 0 to 6) for the specified date. */



hour : data.getHours(), /* The getHours() method returns the hour (from 0 to 23) of the specified date and time. */



minute : data.getMinutes() /* The getMinutes() method returns the minutes (from 0 to 59) of the specified date and time. */



};



/* configuration matrix with holidays */



/* info -> 0 = is not holiday | 1 = is a holiday */



let Holidays = >



'Months' , 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31],



3'January' , response.response 0].a, response.responsee0].b, response.responsee0].c, response.responsee0].d, response.responsee0].e, response.responsee0].f, response.responsee0].g, response.responsee0].h, response.responsee0].i, response.responsee0].j, response.responsee0].k, response.responsee0].l, response.responsee0].m, response.responsee0].n, response.responsee0].o, response.responsee0].p, response.responsee0].q, response.responsee0].r, response.responsee0].s, response.responsee0].t, response.responsee0].u, response.responsee0].v, response.responsee0].w, response.responsee0].x, response.responsee0].y, response.responsee0].z, response.responsee0].aa, response.response.0].ab, response.response.0].ac, response.response.0].ad, response.response.0].ae],



a'February' , response.response 1].a, response.responsee1].b, response.responsee1].c, response.responsee1].d, response.responsee1].e, response.responsee1].f, response.responsee1].g, response.responsee1].h, response.responsee1].i, response.responsee1].j, response.responsee1].k, response.responsee1].l, response.responsee1].m, response.responsee1].n, response.responsee1].o, response.responsee1].p, response.responsee1].q, response.responsee1].r, response.responsee1].s, response.responsee1].t, response.responsee1].u, response.responsee1].v, response.responsee1].w, response.responsee1].x, response.responsee1].y, response.responsee1].z, response.responsee1].aa, response.response.1].ab, response.response.1].ac, response.response.1].ad, response.response.1].ae],



a'March' , response.response>2].a, response.responsee2].b, response.responsee2].c, response.responsee2].d, response.responsee2].e, response.responsee2].f, response.responsee2].g, response.responsee2].h, response.responsee2].i, response.responsee2].j, response.responsee2].k, response.responsee2].l, response.responsee2].m, response.responsee2].n, response.responsee2].o, response.responsee2].p, response.responsee2].q, response.responsee2].r, response.responsee2].s, response.responsee2].t, response.responsee2].u, response.responsee2].v, response.responsee2].w, response.responsee2].x, response.responsee2].y, response.responsee2].z, response.responsee2].aa, response.response.2].ab, response.response.2].ac, response.response.2].ad, response.response.2].ae],



a'April' , response.response>3].a, response.responsee3].b, response.responsee3].c, response.responsee3].d, response.responsee3].e, response.responsee3].f, response.responsee3].g, response.responsee3].h, response.responsee3].i, response.responsee3].j, response.responsee3].k, response.responsee3].l, response.responsee3].m, response.responsee3].n, response.responsee3].o, response.responsee3].p, response.responsee3].q, response.responsee3].r, response.responsee3].s, response.responsee3].t, response.responsee3].u, response.responsee3].v, response.responsee3].w, response.responsee3].x, response.responsee3].y, response.responsee3].z, response.responsee3].aa, response.response.3].ab, response.response.3].ac, response.response.3].ad, response.response.3].ae],



a'May' , response.response 4].a, response.responsee4].b, response.responsee4].c, response.responsee4].d, response.responsee4].e, response.responsee4].f, response.responsee4].g, response.responsee4].h, response.responsee4].i, response.responsee4].j, response.responsee4].k, response.responsee4].l, response.responsee4].m, response.responsee4].n, response.responsee4].o, response.responsee4].p, response.responsee4].q, response.responsee4].r, response.responsee4].s, response.responsee4].t, response.responsee4].u, response.responsee4].v, response.responsee4].w, response.responsee4].x, response.responsee4].y, response.responsee4].z, response.responsee4].aa, response.response.4].ab, response.response.4].ac, response.response.4].ad, response.response.4].ae],



a'June' , response.response/5].a, response.responsee5].b, response.responsee5].c, response.responsee5].d, response.responsee5].e, response.responsee5].f, response.responsee5].g, response.responsee5].h, response.responsee5].i, response.responsee5].j, response.responsee5].k, response.responsee5].l, response.responsee5].m, response.responsee5].n, response.responsee5].o, response.responsee5].p, response.responsee5].q, response.responsee5].r, response.responsee5].s, response.responsee5].t, response.responsee5].u, response.responsee5].v, response.responsee5].w, response.responsee5].x, response.responsee5].y, response.responsee5].z, response.responsee5].aa, response.response.5].ab, response.response.5].ac, response.response.5].ad, response.response.5].ae],



a'July' , response.response/6].a, response.responsee6].b, response.responsee6].c, response.responsee6].d, response.responsee6].e, response.responsee6].f, response.responsee6].g, response.responsee6].h, response.responsee6].i, response.responsee6].j, response.responsee6].k, response.responsee6].l, response.responsee6].m, response.responsee6].n, response.responsee6].o, response.responsee6].p, response.responsee6].q, response.responsee6].r, response.responsee6].s, response.responsee6].t, response.responsee6].u, response.responsee6].v, response.responsee6].w, response.responsee6].x, response.responsee6].y, response.responsee6].z, response.responsee6].aa, response.response.6].ab, response.response.6].ac, response.response.6].ad, response.response.6].ae],



a'August' , response.response 7].a, response.responsee7].b, response.responsee7].c, response.responsee7].d, response.responsee7].e, response.responsee7].f, response.responsee7].g, response.responsee7].h, response.responsee7].i, response.responsee7].j, response.responsee7].k, response.responsee7].l, response.responsee7].m, response.responsee7].n, response.responsee7].o, response.responsee7].p, response.responsee7].q, response.responsee7].r, response.responsee7].s, response.responsee7].t, response.responsee7].u, response.responsee7].v, response.responsee7].w, response.responsee7].x, response.responsee7].y, response.responsee7].z, response.responsee7].aa, response.response.7].ab, response.response.7].ac, response.response.7].ad, response.response.7].ae],



a'September' , response.response 8].a, response.responsee8].b, response.responsee8].c, response.responsee8].d, response.responsee8].e, response.responsee8].f, response.responsee8].g, response.responsee8].h, response.responsee8].i, response.responsee8].j, response.responsee8].k, response.responsee8].l, response.responsee8].m, response.responsee8].n, response.responsee8].o, response.responsee8].p, response.responsee8].q, response.responsee8].r, response.responsee8].s, response.responsee8].t, response.responsee8].u, response.responsee8].v, response.responsee8].w, response.responsee8].x, response.responsee8].y, response.responsee8].z, response.responsee8].aa, response.response.8].ab, response.response.8].ac, response.response.8].ad, response.response.8].ae],



a'October' , response.response 9].a, response.responsee9].b, response.responsee9].c, response.responsee9].d, response.responsee9].e, response.responsee9].f, response.responsee9].g, response.responsee9].h, response.responsee9].i, response.responsee9].j, response.responsee9].k, response.responsee9].l, response.responsee9].m, response.responsee9].n, response.responsee9].o, response.responsee9].p, response.responsee9].q, response.responsee9].r, response.responsee9].s, response.responsee9].t, response.responsee9].u, response.responsee9].v, response.responsee9].w, response.responsee9].x, response.responsee9].y, response.responsee9].z, response.responsee9].aa, response.response.9].ab, response.response.9].ac, response.response.9].ad, response.response.9].ae],



a'November' , response.response 10].a, response.response.10].b, response.response.10].c, response.response.10].d, response.response.10].e, response.response.10].f, response.response.10].g, response.response.10].h, response.response.10].i, response.response.10].j, response.response.10].k, response.response.10].l, response.response.10].m, response.response.10].n, response.response.10].o, response.response.10].p, response.response.10].q, response.response.10].r, response.response.10].s, response.response.10].t, response.response.10].u, response.response.10].v, response.response.10].w, response.response.10].x, response.response.10].y, response.response.10].z, response.response.10].aa, response.responser10].ab, response.responser10].ac, response.responser10].ad, response.responser10].ae],



a'December' , response.response 11].a, response.response.11].b, response.response.11].c, response.response.11].d, response.response.11].e, response.response.11].f, response.response.11].g, response.response.11].h, response.response.11].i, response.response.11].j, response.response.11].k, response.response.11].l, response.response.11].m, response.response.11].n, response.response.11].o, response.response.11].p, response.response.11].q, response.response.11].r, response.response.11].s, response.response.11].t, response.response.11].u, response.response.11].v, response.response.11].w, response.response.11].x, response.response.11].y, response.response.11].z, response.response.11].aa, response.responser11].ab, response.responser11].ac, response.responser11].ad, response.responser11].ae]



];



/* Adjusting the current month of the year to the Holidays table format */



currentDate.month++



/* checks if the current date is a holiday */



if (HolidaysrcurrentDate.month] currentDate.day] == 0){



isHoliday = false /* --> is not a Holiday */



}else{



isHoliday = true /* --> is a Holiday */



}



return isHoliday



}



💡 Não se esqueça de nas variáveis de entrada passar o retorna da requisição (no meu caso responsesheets) e de salvar o retorno do script (que no meu caso vai ser isHoliday):





Em seguida, basta tratar nas ações de saída do bloco:





Aqui tem o JSON para você testar e ser muito feliz, só pedir acesso e brincar à vontade: https://drive.google.com/file/d/1lT8-YqU3k909GZohQX2h6j4QBG77J_B-/view?usp=sharing



Feliz Natal Galerinha, juro que um dia trago o tanto de coisa que to devendo pra vocês, tem alguma mudanças vindo ai, quem sabe agora terei mais tempo pras DOCs, e juro que sempre que eu tiver uns trem desse eu compartilho, interajam ai no comentários caso tenham dúvidas, vamos nos ajudar a crescer cada vez mais BEJÃO AMO VOCÊS E REXPEITA QUE O PAI AGORA É 2.1



Que massa @Pedro_Lucas presentão ai pra nós. 🤩


Muito bom !!! Parabens @Pedro_Lucas !!!


Valeu por esse presente @Pedro_Lucas !


Ficou show de bola o modelo, desse jeito dá pra configurar feriado de olhos fechados e com as mãos pra trás! #ezpz



E aproveitando, parabéns por mais um ano de vida! 🎂🥳 tmj demais.



:blipinlove:


De todas as alternativas que encontrei no fórum, essa foi a que melhor atendeu nossa necessidade aqui!



Muito bom, parabéns e obrigado!!


@Pedro_Lucas! Seu post já vai fazer aniversário e continua até hoje ajudando os membros da comunidade! 😍



Valeeeu por compartilhar, @joao.fiorini! 😉


ele ja fez na real




@Pedro_Lucas Consegue me dar acesso ao Gsheets? mandei um request [email protected]



Valeu! abs


aqui nao chegou nadA


Opa! Mandei mensagem novamente.


Abs


Comente