Pesquisar neste blog
Mostrando postagens com marcador Excel. Mostrar todas as postagens
Mostrando postagens com marcador Excel. Mostrar todas as postagens
16/04/2024
11/06/2023
Inserir linhas no Google Sheets com JavaScript
Objetivo : Inserir uma quantidade X de linhas por comando da Planilha_1 para a Planilha_2 de outra URL da web com JavaScript.
Código feito no Google Sheets
function myFunction() {
var url2 = "Insira sua url aqui !";
var QtdlinhasDesejada = 2;
var spreadsheet = SpreadsheetApp.openByUrl(url2);
//spreadsheet.getRange('1:1').activate();
spreadsheet.getActiveSheet().insertRowsBefore(spreadsheet.getActiveRange().getRow(),
QtdlinhasDesejada );
//spreadsheet.getActiveRange().offset(0, 0, 1,
spreadsheet.getActiveRange().getNumColumns()).activate();//0 ,0, 1
//spreadsheet.getRange('C9').activate();
};
Execução e saída gerada |
02/05/2023
Salvar dados de uma planilha em planilha com google sheets #01
Objetivo: Salvar os dados de uma planilha para outra planilha.
1- Copiar os dados da planilha A
2- Colar em outra URL da planilha B
3- Apagar os dados da planilha A
Resolução:
Código feito em JavaScript
function copyAndPaste() {
var sourceSheetName = "Rascunho"; // Nome da planilha de origem
var destSheetName = "Dados Salvo"; // Nome da planilha de destino
// Obter as planilhas de origem e destino
var sourceSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(
sourceSheetName);
var destSheet = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/
d/1demeaOTz2gUeSOwjCfOi95RGl2LXEoXWf77SYhvqPjo/edit?usp=sharing"
).getSheetByName(destSheetName);
// Copiar os dados e a formatação
var range = sourceSheet.getDataRange();
var values = range.getValues();
var formats = range.getNumberFormats();
destSheet.getRange(1, 1, values.length, values[0].length).setValues(values).
setNumberFormats(formats);
// Apagar os dados da planilha de origem
sourceSheet.clearContents();
}
Planilha A |
Planilha B |
Palavras chave:
Zapisz dane z arkusza kalkulacyjnego do arkusza kalkulacyjnego za pomocą Arkuszy Google
Save data from spreadsheet to spreadsheet with google sheets
Lagre data fra regneark til regneark med google sheets
Сохранение данных из электронной таблицы в электронную таблицу с помощью таблиц Google
שמור נתונים מגיליון אלקטרוני לגיליון אלקטרוני באמצעות google sheets
Spara data från kalkylark till kalkylark med google sheets
حفظ البيانات من جدول البيانات إلى جدول البيانات مع أوراق جوجل
14/11/2022
Salvar em outra planilha com Google Sheets
Salvar dados de 1 planilha para outra planilha no Google Sheets com mais de 1 linha
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet1 = ss.getSheetByName("Dados");
// Link da planilha para qual deseja salvar
const ssId = "1Y7MX60VaqL9fQEd3ej3hvqvfKP0LE5w2IXBsws4WZcM";
const ssBase = SpreadsheetApp.openById(ssId);
// Nome da guia que deseja salvar
const sheetBase = ssBase.getSheetByName("BASE");
function copiareColarOutraPlanilha(){
let validacao = sheetBase.getRange("A1").getValue();
if(validacao == ""){
var rowInicio = 1;
var lastRow = 1;
}else{
var rowInicio = 2;
var lastRow = sheetBase.getRange("A1").getNextDataCell(SpreadsheetApp.Direction.DOWN).getRow() + 1;
}
let area = sheet1.getRange("A" + rowInicio + ":B").getValues();
sheetBase.getRange("A" + lastRow + ":B" + (lastRow + area.length - 1)).setValues(area);
}
07/11/2022
Inserir linhas em outra planilha no google sheets
Objetivo: Inserir quantidade x de linhas em outra planilha com google sheets
Planilha atual |
Script para inserir várias linhas em outra planilha
function InserirLinhasNovaPlanilha(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet1 = ss.getSheetByName("Rota"); // Guia da planilha usada
//link da planilha onde deseja inserir
var ssBase = SpreadsheetApp.openById("1kVaDyY_vSwNQbjCyuKKWczucfpWInhNSU0arlOnuN_4");
var sheetBase = ssBase.getSheetByName("H1");// nome da aba que deseja salvar
var ultimaLinha = guiaMenu.getLastRow();
for (let i = 0; i < ultimaLinha; i++){
ssBase.getRange('1:1').activate();
ssBase.getActiveSheet().insertRowsBefore(ssBase.getActiveRange().getRow(), 1);
ssBase.getActiveRange().offset(0, 0, 1, ssBase.getActiveRange().getNumColumns()).activate();
}
}
Saída gerada |
28/09/2022
Inserir linhas com API Google Sheets
Objetivo: Inserir uma quantidade X de linhas em uma aba com base na última linha com dados em outra aba do google sheets.
Código utilizado:
function QtdLinhas2(){
var planilha = SpreadsheetApp.getActiveSpreadsheet();
var guiaMenu = planilha.getSheetByName("Dados 1");
var guiadados = planilha.getSheetByName("Dados 2");
var ultimaLinha = guiaMenu.getLastRow();
Browser.msgBox(ultimaLinha);
for(let i = 0; i < ultimaLinha; i++){
guiadados.getRange('1:1').activate();
planilha.getActiveSheet().insertRowsBefore(guiadados.getActiveRange().getRow(), 1);
guiadados.getActiveRange().offset(0, 0, 1, guiadados.getActiveRange().getNumColumns()).activate();
}
}
Palavras chave:
Geli safafka Google Sheets API
Chèn hàng bằng API Google Trang tính
Inserere Ordines apud Google rudentis API
Indsæt rækker med Google Sheets API
Inserați rânduri cu API-ul Google Sheets
Google Sheets API yordamida qatorlarni kiriting
गूगल शीट्स एपीआई के साथ पंक्ति डालें
Вставка строк с помощью Google Sheets API
Wstaw wiersze za pomocą interfejsu API Arkuszy Google
Lebokake Rows nganggo Google Sheets API
Rigen ynfoegje mei Google Sheets API
26/09/2022
Ultima linha com dados no API Google Sheets
Objetivo: Realizar a quantificação da última linha com dados no Google Sheets
Código 1:
function QtdLinhas() {
var planilha = SpreadsheetApp.getActiveSpreadsheet();
var guiaMenu = planilha.getSheetByName("Dados 1");
var ultimaLinha = guiaMenu.getLastRow(); //ultima linha com dados
Browser.msgBox(ultimaLinha);
}
Saída no Google Sheets |
Palavras chave:
Last line with data in Google Sheets API
Última línea con datos en Google Sheets API
Последняя строка с данными в Google Sheets API
Останній рядок із даними в API Google Таблиць
שורה אחרונה עם נתונים ב-Google Sheets API
Sista raden med data i Google Sheets API
Lescht Zeil mat Daten an Google Sheets API
Zadnji redak s podacima u Google Sheets API-ju
Dòng cuối cùng với dữ liệu trong API Google Trang tính
Khadka u dambeeya ee xogta Google Sheets API
11/09/2022
Uso de for no google Sheets
Código na IDE do google sheets em linguagem JavaScript
function debug(){
var square = 0;
for(var i = 0; i < 10; i++){
square = i + 1;
Logger.log(square);
}
}
09/09/2022
Notificação no Apps google sheets
Código feito na IDE do google sheets
function MSG(){
SpreadsheetApp.getActiveSpreadsheet().toast("Atenção !", "NOTIFICAÇÃO");
}
Palavras chave:
Cuadro de mensaje en hojas de Google de aplicaciones
Message box in Apps google sheets
Pole wiadomości w arkuszach Google Apps
Üzenőmező az Apps Google-lapokon
Apps google sheet 中的消息框
תיבת הודעות ב-Google Sheets של Apps
Оквир за поруке у Гоогле табелама за апликације
Hafatra hafatra ao amin'ny Apps google sheets
Meddelelsesfelt i Apps google sheets
06/09/2022
Mensagem box no Apps google sheets
Código feito na IDE do google sheets
function MSG(s1, s2){
Browser.msgBox("Blog da Engenharia Cotidiana", "Bem Vindo(a)", Browser.Buttons.OK);
}
Palavras chave:
Cuadro de mensaje en hojas de Google de aplicaciones
Message box in Apps google sheets
Pole wiadomości w arkuszach Google Apps
Üzenőmező az Apps Google-lapokon
Apps google sheet 中的消息框
תיבת הודעות ב-Google Sheets של Apps
Оквир за поруке у Гоогле табелама за апликације
Hafatra hafatra ao amin'ny Apps google sheets
Meddelelsesfelt i Apps google sheets
24/08/2022
Gráfico de barras no google sheets
Comando utilizado:
=SPARKLINE(B3;{"charttype"\"bar";"max"\1;"color1"\"orange"})
=SPARKLINE(B4;{"charttype"\"bar";"max"\1;"color1"\"red"})
=SPARKLINE(B5;{"charttype"\"bar";"max"\1;"color1"\"7CFC00"})
=SPARKLINE(B6;{"charttype"\"bar";"max"\1;"color1"\"grey"})
=SPARKLINE(B7;{"charttype"\"bar";"max"\1;"color1"\"DeepSkyBlue"})
12/01/2021
Mensagem automática no Google Planilhas do Excel VBA
function onEdit() {//função salva automática sempre que houver alguma alteração
Browser.msgBox("Olá Mundo!")
}
10/12/2020
Formulário de Login em Excel VBA
Excel 2010 |
btnentrar Click
Private Sub btnentrar_Click()
Dim usuario As String
Dim senha As String
Dim combinação As Boolean
Dim comb1 As String
Dim comb2 As String
usuario = Me.txusuario.Value
senha = Me.txsenha.Value
combinação = False
comb1 = usuario & senha
'combinação linha e senha'
linhas = WorksheetFunction.CountA(Plan1.Columns("A")) - 1 'conta as linhas'
For cont = 2 To linhas
comb2 = Plan1.Cells(cont, 1).Value & Plan1.Cells(cont, 2).Value
combinação = comb1 = comb2
If combinação = True Then
MsgBox "USUÁRIO AUTORIZADO !", vbInformation, "OK" 'ICONE DE BEM VINDO'
Unload Me
Exit Sub
'fechando a estrutura condicional'
End If
Next 'senão'
MsgBox "USUÁRI OU SENHA INCORRETOS !", vbCritical, "ERROR"
End Sub
btnsair Click
Private Sub btnsair_Click()
ThisWorkbook.Close 'fecha a planilha'
End Sub
09/12/2020
Sistema de Cadastro em Excel VBA
Excel 2010 |
(Geral) (Declaração)
Private Sub btninserir_Click()
Dim ulinha As Long 'identifica número da ultima linha'
ulinha = Plan1.Range("a1048576").End(xlUp).Row + 1 'próximo da ultima linha'
Plan1.Cells(ulinha, 1).Value = Me.txid.Value 'coluna 1'
Plan1.Cells(ulinha, 2).Value = Me.txdata.Value
Plan1.Cells(ulinha, 3).Value = Me.txnome.Value
Plan1.Cells(ulinha, 4).Value = Me.txidade.Value
Plan1.Cells(ulinha, 5).Value = Me.cbcurso.Value
MsgBox "OPERAÇÃO REALIZADA COM SUCESSO !"
End Sub
Private Sub UserForm_Initialize()
Dim utimoid As Long 'pegar o último índice'
Me.txdata.Value = Date
ultimoid = Plan1.Range("a1048576").End(xlUp).Value
Me.txid.Value = ultimoid + 1
End Sub
CommandButtom1 Click
Private Sub CommandButton1_Click()
UserForm1.Show 'chamando o objeto'
End Sub
08/12/2020
07/12/2020
Formatação de dados com Format em Excel VBA
Excel 2010 |
Private Sub btncd_Change()
Me.txcd.Value = Format(Me.txcd, "0.00") '2 casas de formatação")
End Sub
Private Sub ToggleButton1_Click()
Me.txreal.Value = Format(Me.txreal, "R$ #,###.000") 'Formato real com 3 casas decimais'
End Sub
Private Sub btndata_Click()
Me.txdada.Value = Format(Me.txdada, "dd/mm/yyyy")
End Sub
05/12/2020
Forlulário ListBox com ListOptions em Excel VBA
Excel 2010 |
Private Sub btnexcluir_Click()
Dim nlinha As Long
nlinha = Me.lbdados.ListIndex
'removendo item que está selecionado na variável nlinha'
Me.lbdados.RemoveItem (nlinha)
End Sub
Private Sub btnInserir_Click()
Dim lista As Long
lista = 0
'contagem da lista, se a lista for diferente de 0'
If lbdados.ListCount <> 0 Then lista = (lbdados.ListCount + 1) - 1
With lbdados
.AddItem
'trabalhando com Lista'
.List(lista, 0) = Me.txnome.Value 'linha 0, coluna 0'
.List(lista, 1) = Me.txidade.Value
.List(lista, 2) = Me.txendereco.Value
End With
End Sub
Private Sub btnmostrar_nome_Click()
Dim nlinha As Long
Dim nome As String
nlinha = Me.lbdados.ListIndex
nome = Me.lbdados.List(nlinha, 0) 'exibindo a linha e a coluna'
MsgBox "Nome selecionado: " & nome
End Sub
Private Sub UserForm_Click()
End Sub
Assinar:
Postagens (Atom)