I have a Google Spreadsheets containing about 50 rows, each of which has values in the first four cells of the row. I'd like to build something where I can click a button (or a cell?) and have it return one of these rows, selected randomly. I had assumed that this would be fairly simple in Google Sheets, but lots of searching online hasn't yielded anything useful.
I'm open to building something different (simple web app?) that will still do what I'm looking for.
Does anyone know how to do this, or even know some different language that I should be using as search terms?
If you insert a new ColumnA and populate it with:
=randbetween(1,100)
you might then use a formula like:
=query(Sheet1!A1:E50,"select B,C,D,E order by A limit 1")
and even have this update itself every minute or hour by selecting Recalculation in Spreadsheet settings..., otherwise on command with Ctrl+R.
HOWEVER, the result is effectively provisional until the sheet has saved.
You can use Google Apps Script, which will allow you to add the functionality you require into your spreadsheet. It uses JavaScript and the link I have given above will lead to some easy to follow examples. If you get stuck, then the Web Applications Stack Exchange site has many Q & A's on scripting Google's web apps.
If you reach the limits of Google Apps Script at some point, you may write your own application which interacts with your Google Sheet via their API. The APIs support multiple scripting and programming languages and searching Github will yield many open source libraries helpful for using Google Sheets and other Google Apps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With