Vídeo recomendado
https://youtu.be/diWPPPhW-9E
https://youtu.be/diWPPPhW-9E
Google Script
Google Script
Boa noite,
Estou com um problema no código abaixo poderia me auxiliar?
Estou fazendo um código pra que toda vez que a coluna "A" tenha alguma linhas preenchidas com o valor "P" a coluna "C" tenha o numero da linha respectiva, como vc pode ver o valor 5 apareceu numa linha distante e nas outras não temos valores.
exemplo
A1 = P
B1 = 1
A2 = P
B2= 2 Obg
Estou com um problema no código abaixo poderia me auxiliar?
Estou fazendo um código pra que toda vez que a coluna "A" tenha alguma linhas preenchidas com o valor "P" a coluna "C" tenha o numero da linha respectiva, como vc pode ver o valor 5 apareceu numa linha distante e nas outras não temos valores.
exemplo
A1 = P
B1 = 1
A2 = P
B2= 2 Obg
Re: Google Script
webmaster,
Vou explicar melhor minha aplicação, estou com um googleforms vinculado a essa planilha, e a cada nova "resposta/solicitação" o forms cria uma linha nova no spreadsheet, por isso a necessidade do script.
obrigado
Vou explicar melhor minha aplicação, estou com um googleforms vinculado a essa planilha, e a cada nova "resposta/solicitação" o forms cria uma linha nova no spreadsheet, por isso a necessidade do script.
obrigado
Re: Google Script
vinisoldi,
A linha 12 deveria ser isso:
Veja se funciona.
A linha 12 deveria ser isso:
Código: Selecionar todos
range.offset(0, 2).setvalue(data);
Re: Google Script
function myFunction12() {
var ActiveSheet= SpreadsheetApp.getActiveSheet();
var name = ActiveSheet.getName();
var lastrow = ActiveSheet.getLastRow();
for(var i=1; i=lastrow; i++){
var range= ActiveSheet.getRange(i,1);
if(range.getValue() == 'P' && name == 'teste'){
var data = range.getRow();
range.offset(0, 1).setValue(data);
}
i++
}
}
var ActiveSheet= SpreadsheetApp.getActiveSheet();
var name = ActiveSheet.getName();
var lastrow = ActiveSheet.getLastRow();
for(var i=1; i=lastrow; i++){
var range= ActiveSheet.getRange(i,1);
if(range.getValue() == 'P' && name == 'teste'){
var data = range.getRow();
range.offset(0, 1).setValue(data);
}
i++
}
}
Re: Google Script
Tente isso:
Código: Selecionar todos
function myFunction12() {
var ActiveSheet = SpreadsheetApp.getActiveSheet();
var name = ActiveSheet.getName();
var lastrow = ActiveSheet.getLastRow();
for (var i = 1; i = lastrow; i++) {
var range = ActiveSheet.getRange(i, 1);
if (range.getValue() == 'P' && name == 'teste') {
var data = range.getRow();
range.offset(0, 1).setValue(data);
}
}
}
Re: Google Script
tentei o código acima porem não deu certo, continua apenas inserindo o valor na ultima linha
Re: Google Script
O erro estava na declaracao do for. Agora vai!
Código: Selecionar todos
function myFunction12() {
var ActiveSheet = SpreadsheetApp.getActiveSheet();
var name = ActiveSheet.getName();
var lastrow = ActiveSheet.getLastRow();
for (var i = 1; i < lastrow; i++) {
var range = ActiveSheet.getRange(i, 1);
if (range.getValue() == 'P' && name == 'teste') {
var data = range.getRow();
range.offset(0, 1).setValue(data);
}
}
}