I have 5 sheets in my Google Spreadsheet document and i am trying to see if it is possible have a plugin or function to rotate each sheets every 10 sec?
Please let me know.
thanks
Found this thread on how to set the spreadsheet to switch between the different sheets every N seconds.
Example:
Option Explicit
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Public Sub Switch()
Dim ws As Worksheet
Do
For Each ws In ThisWorkbook.Worksheets
ws.Activate
Application.Wait Now() + TimeValue("00:00:05")
If GetAsyncKeyState(vbKeyShift) Then Exit Sub
DoEvents
Next ws
Loop
End Sub
This will loop through all worksheets in the current workbook every five seconds, then when it's done it loops round to do again.
Related
Find 14+ ways to repeat range with formulas.
do it with a small range which has duplicates.
each formula should start from different function.
make formulas as short as you can.
Sample data:
A
B
ðYay!
1
ðWow!
2
ð€£Ah!
3
ð€£Ah!
3
The desired result is the same range, repeated by formulas with the use of built-in functions.
I've created a template sheet with all possible ways I could do it. Is there something I've missed?
there are always more like:
=OFFSET(B3,,,4,2)
=ARRAYFORMULA(IF(,,B3:C6))
=INDEX(IF(,,B3:C6))
=INDIRECT("R3C2:R6C3", )
=INDIRECT(ADDRESS(3, 2)&":"&ADDRESS(6, 3))
or:
=INDEX(VLOOKUP(ROW(B3:B6), {ROW(B3:C6), B3:C6}, {2, 3}, 0))
=INDEX(TEXT(B3:C6, "#"))
={B3:B6, C3:C6}
=INDEX(ARRAY_CONSTRAIN(UNIQUE({B3:C6, ROW(B3:C6)}), 9^9, 2))
further you go it's more questionable why would you do it that way and not the obvious easy way... e.g. one day we would need to do it for example this way due to some specific reasons:
=INDEX(SPLIT(FLATTEN(QUERY(TRANSPOSE(B3:C6),,9^9)), " "))
but not for casual usage tho.
Sample File
Functions to Repeat a Range
These functions can produce a range:
#
Function
Formula Sample
1
{}
={B3:C6}
2
ArrayFormulaâ¡1
=ARRAYFORMULA(B3:C6)
3
INDEXâ¡
=INDEX(B3:C6)
4
FILTERâ¡
=FILTER(B3:C6,ROW(B3:B6))
5
SORTâ¡
=SORT(B3:C6,SEQUENCE(4),1)
6
SORTNâ¡
=SORTN(B3:C6,2^99,0,SEQUENCE(4),1)
7
QUERY
=QUERY(B3:C6)
8
OFFSET
=OFFSET(B3:C6,,)
9
ARRAY_CONSTRAIN
=ARRAY_CONSTRAIN(B3:C6,4,2)
10
TRANSPOSE
=TRANSPOSE(TRANSPOSE(B3:C6))
11
UNIQUE
=UNIQUE(B3:C6,1)
12
INDIRECT
=INDIRECT("B3:C6")
13
IMPORTRANGE
=IMPORTRANGE(SS_ID,"Sheet1!B3:C6")
14
IMPORTDATA
=IMPORTDATA(CSV_URL)
IMPORTHTML
=IMPORTHTML(HTML_URL,"table",1)
IMPORTXML
=IMPORTXML(HTML_URL,"//tr[td]")
1â¡â ArrayFunctions. They convert expression inside into array. Sample: =index(C3:C6*3)
SS_ID
Spreadsheet ID or URL, the first parameter for IMPORTRANGE
For my sample file:
https://docs.google.com/spreadsheets/d/1vP2866RplNvcJz7ZOn-CUqVuspF_ARdBk__QSqpg79E/edit#gid=0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Use the whole URL, or ID: 1vP2866RplNvcJz7ZOn-CUqVuspF_ARdBk__QSqpg79E
CSV_URL and HTML_URL
The IMPORTDATA function requires .csv data source.
IMPORTHTML and IMPORTXML require .html data source.
You may convert your Google Spreadsheet into both:
Go to File > Share > Publish to Web
Select Web Page or Comma Separated Values (.csv)
Select Sheet to import and proceed.
Add range reference to the url: &range=B3:C6
Sample html URL:
https://docs.google.com/spreadsheets/d/e/2PACX-1vQSjBDAV36sy3ua2TSbLEXPsn0_h-_iUCTWKBMgUL2T8TcQt2-1X_vl0GxGlhK04BubF1phiJZQLwJa/pubhtml?gid=0&range=B3:C6&single=true
You may open it like a usual url!
Sample csv URL:
https://docs.google.com/spreadsheets/d/e/2PACX-1vQSjBDAV36sy3ua2TSbLEXPsn0_h-_iUCTWKBMgUL2T8TcQt2-1X_vl0GxGlhK04BubF1phiJZQLwJa/pub?gid=0&range=B3:C6&single=true&output=csv
Other functions
All other cases use the same finctions as descrided to reproduce a range. The first function should be always an ArrayFunction or a function that can reproduce a range.
See also:
RANDARRAY - creates array of random numbers
SEQUENCE - creates a sequence 1,2,3... etc.
FLATTEN - gets an aray and produces the 1-column output
I've got a Spreadsheet where on the sheet "Dados de Cadastro e Resumo" on column K (from roll 7 to 29) I'm using the formula =IF(J7="";"";SUM(QUERY({Caminhoneiro!G:I;Centralizado!G:I;Djoko!G:I};"Select Col2 where Col1 = '"&J7&"'";))) to sum up the hours from the sheets "Caminhoneiro","Djoko" and "Centrealizado".
The thing is, I want to make it so I don't have to edit the formula every time to accommodate for new sheets. My ideia was to use the names on column E (from roll 7 to 29) and make the reference for the Query based on that.
So far I've got the string done (on M6), but haven't been successful on turning that on to a valid array reference (using INDIRECT, which I later learned doesn't deal with multiple intervals.
I shared a file of Google sheets with my collaborator, and every day he will input the data into the row of Google Sheets, and I want to lock that row after 1 hour after he finishes his work!
You can use Apps Script for this. Use a time-driven installable trigger in a script that protects/locks the sheet.
Your code should be something like this:
var sheet = SpreadsheetApp.getActiveSheet();
var permissions = sheet.getSheetProtection();
permissions.setProtected(true);
sheet.setSheetProtection(permissions);
Very simple question.
How do you make endless row on spreadsheet? Like Excel.
I have this problem when I use google sheet to scan barcodes.
When rows reached 1000, I need to add more manually.
But sometimes I forget, then I keep scanning.
After that I check my sheet, I missed a lot of input but I don't remember which barcode was the last one, so I have to do them all over again after increasing the rows.
If google sheets has the infinite rows like Excel, I won't have to worry about it no more.
Do you guys have any solutions on this?
Use Apps Script to Make Your Sheet Dynamic
With Apps Script, you can write a function to detect how many cells are between the data inserted and the end of the spreadsheet, and add rows if they are too close.
function addRowsIfCloseToEnd() {
let file = SpreadsheetApp.getActive();
// INPUT YOUR SHEET NAME HERE
let sheet = file.getSheetByName("Sheet1");
let maxRow = sheet.getMaxRows()
let lastRow = sheet.getLastRow()
// In this example, when the values are 100 rows
// from the end of the sheet, it will add 100 rows
// to the end. Change this to your liking.
if (maxRow - lastRow < 100) {
sheet.insertRowsAfter(maxRow, 100)
}
}
In this example, the function checks when values are less than 100 rows from the end of the spreadsheet, and if it is, it will add 100 extra rows to the sheet.
You should adjust these numbers to suit your workflow, I don't know how many bar codes you scan or how quickly.
You have two options for how to trigger this:
onEdit
This is a simple trigger designed to run a function every single time there is an edit on the sheet. You can call the previous function like this:
function onEdit() {
addRowsIfCloseToEnd()
}
If you have authorized your script, then this should run every time you make an edit:
In this example I only add 10 rows every time, to demonstrate.
Time-based trigger
Depending on how many barcodes you scan and how quickly, you may not want this function to run every single time you scan a barcode, in which case you can make a trigger to run every 5 minutes for example:
function createClockTrigger() {
ScriptApp.newTrigger("addRowsIfCloseToEnd")
.timeBased()
.everyMinutes(5)
.create();
}
References
Apps Script
Tutorials
Simple Triggers
onEdit
ClockTriggerBuilder
I'd like to insert time windows repeatedly in a column, like this:
10:00-10:20
10:20-10:40
10:40-11:00
11:00-11:20
11:20-11:40
12:00-12:20
Is there a way to achieve this?
Put data in cells:
B1 = 10:00 (start time)
B2 = 12:20 (end time)
B3 = 20 (interval in minutes)
Here's single arrayFormula, that will generate your column:
=ARRAYFORMULA(TEXT(B1+B3*1/24/60*(row(OFFSET(B8,,,(B2-B1)/(B3*1/24/60)))-row(B7)-1),"HH:MM")&"-"&TEXT(B1+B3*1/24/60*(row(OFFSET(B8,,,(B2-B1)/(B3*1/24/60)))-row(B7)),"HH:MM"))
Explanations
Look at sample file to explore more about this formula. Pay attention on some details:
any kind of logical sequence could be done with help of series 1,2,3... Formula like =ARRAYFORMULA(row(OFFSET(B8,,,7))-row(B7)) gives us column from 1 to 7.
Time treated like numbers in sheets: 1 day is 1, 1 hour is 1/24, 1 minute is 1/24/60 and so on
Time can't be properly converted into text as it's number. So you have to use text(time, "HH:MM") formula to convert time into text.
This will repeat your time window. The formula assumes the time range is in A2:A6.
The 3 in the formula is the number of repeats (change to you need). You might want
to consider placing A2:A6 on another sheet and referencing it in the formula.
=TRANSPOSE(SPLIT(JOIN(",", ARRAYFORMULA(SPLIT(transpose(rept(join(",",A2:A6)&",",3)),",")&",")), ","))