Find Jobs
Hire Freelancers

Fix a Google Script

$10-30 USD

Concluído
Publicado há quase 7 anos

$10-30 USD

Pago na entrega
I need the script copied below to hide rows prior to today's date for the spreadsheet linked below. Spreadsheet: [login to view URL] Script: /** * Looks for rows with old dates, and hides them if so. * It finds the date column my checking the first column for the word 'Date'. */ function hideOldRows(colNum) { var ss = [login to view URL]('1d0-hBf96ilIpAO67LR86leEq09jYP2866uWC48bJloc'); var sheet = [login to view URL]()[0]; var header = [login to view URL](4, 1, 1, [login to view URL]()); var colNum = [login to view URL]()[0].indexOf('Date') + 1; if (colNum === 0) { [login to view URL]([login to view URL]()); throw Error('Could not find the word Date on the first row'); } var rows = [login to view URL](1, colNum, [login to view URL](), 1); var numRows = [login to view URL](); var values = [login to view URL](); for (var i = 0; i <= numRows - 1; i++) { var row = values[i]; if (isDate(row[0]) && isOld(row[0])) { [login to view URL](i + 1); } } }; function isDate(dateString) { return (new Date(dateString)) != "Invalid Date"; // notice not !== } function isOld(dateString) { assert(isDate(dateString)); var inDate = (new Date(dateString)).getTime(); var yesterday = new Date(); [login to view URL]([login to view URL]() - 1); return yesterday > inDate; } function assert(b, msg) { msg = msg || "default message"; if (!b) { throw Error(msg) } } function test() { assert(isOld('Fri Jan 04 00:00:00 GMT-05:00 2013')); assert(!isOld('Fri Jan 04 00:00:00 GMT-05:00 2018')); } /** * Adds a custom menu to the active spreadsheet, containing a single menu item * for invoking the readRows() function specified above. * The onOpen() function, when defined, is automatically invoked whenever the * spreadsheet is opened. * For more information on using the Spreadsheet API, see * [login to view URL] */ function onOpen() { var sheet = [login to view URL](); var entries = [{ name : "Hide Old Rows", functionName : "hideOldRows" }]; [login to view URL]("Scripts", entries); };
ID do Projeto: 14421271

Sobre o projeto

4 propostas
Projeto remoto
Ativo há 7 anos

Quer ganhar algum dinheiro?

Benefícios de ofertar no Freelancer

Defina seu orçamento e seu prazo
Seja pago pelo seu trabalho
Descreva sua proposta
É grátis para se inscrever e fazer ofertas em trabalhos
Concedido a:
Avatar do Usuário
$25 USD em 1 dia
5,0 (63 avaliações)
5,1
5,1

Sobre o cliente

Bandeira do(a) UNITED STATES
Nashville, United States
5,0
15
Método de pagamento verificado
Membro desde out. 20, 2014

Verificação do Cliente

Obrigado! Te enviamos um link por e-mail para que você possa reivindicar seu crédito gratuito.
Algo deu errado ao enviar seu e-mail. Por favor, tente novamente.
Usuários Registrados Total de Trabalhos Publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Carregando pré-visualização
Permissão concedida para Geolocalização.
Sua sessão expirou e você foi desconectado. Por favor, faça login novamente.