Select worksheet Google Visualization API Query Language - google-sheets

I am reading this.
Is there a way I can select worksheet there, I need to do queries in a specific worksheet.
I tried with Google Spreadsheet API, but answer I am getting is difficult to parse, since fields are calculated by Google and there is no documentation about them.
Workaround
I just moved sheet to the first position and it worked with a query like the one specified in the first link I posted.
Note the first sheet is selected by default and there is no way to select sheet, that, is my question.

Easier than trying luck with a gid number there is the possibilty to pass sheet parameter with sheet name:
https://spreadsheets.google.com/tq?key=0AsD4widwbn0rdE9HM2VwZ1h2UktFUi0xTy1lOVlqblE&sheet=sheet1&tq=select%20A
https://spreadsheets.google.com/tq?key=0AsD4widwbn0rdE9HM2VwZ1h2UktFUi0xTy1lOVlqblE&sheet=sheet2&tq=select%20A
Note the sheet parameter. I could not find source of this again.

Use gid=
like this:
https://spreadsheets.google.com/tq?key=0Ao_WaOWBqWmjdGRZV3dxdW1sdXhaeUs0cko5ZEVldEE&gid=0&tq=select%20A
https://spreadsheets.google.com/tq?key=0Ao_WaOWBqWmjdGRZV3dxdW1sdXhaeUs0cko5ZEVldEE&gid=4&tq=select%20A
Notice that the gid is not the same, and the result is not the same.
Note: gid values start at 0, so sheet1: gid=0, sheet2: gid=1. The gid values never change even if a sheet is deleted/renamed.

Related

Google Sheets: IMPORTRANGE Values Matched To A Custom ID

I am building a Google sheet that references data from a source sheet where columns and rows may shift, and values may even change. Because shifting can occur, an ID system has been implemented. Here is a very simplified version:
In my own sheet, the goal is to pull in values and place them based on the corresponding ID. Currently, to pull this off, I am using the IMPORTRANGE function with a FILTER to get the desired value, based on the ID in the column. So to find and place the value "United States" underneath ID 1, I use the following:
=FILTER(IMPORTRANGE("doc_url", "Sheet1!A1:A5"),IMPORTRANGE("doc_url", "Sheet1!B1:B5")=A1)
I am aware it's not super great to use IMPORTRANGE on a cell-by-cell basis, as it becomes quite intensive with heavy usage (and the actual sheet I am building has many more values to pull). I feel like there must be a more efficient way to pull and arrange these values by the correct ID, but I haven't been able to figure it out so far.
Is it possible to build a function that would pull the full range in the order I am expecting all in one go?
Example Source Sheet
Example Target Sheet
try in A2:
=INDEX(IFNA(HLOOKUP(A1:E1,
TRANSPOSE(QUERY(IMPORTRANGE("doc_url", "Sheet1!A1:B5"),
"select Col2,Col1", )), 2, 0)))

Formula for looking up and filtering data from a sheet

I want to do a complex formula using google sheets:
I have a list of place that will be visited by different people.
Some places are not to be visited, marked with /
Some places need to be assigned, marked with ?
Wanted outcome:
A list of cells that changes every day automatic.
An overview of who is going where that day and what needs to be assigned.
So I need a formula that can select a row based on today() and then filter out Persons in that row. Then for each person, another formula that looks up the first row in the table and puts duplicates together.
Example:
Wanted outcome:
Link to excel file, but it needs to work in google sheets too: xlsx
My solution is not the most elegant but it does the job.
First I build a column with date and unique persons or ? in this column:
=unique(sort(transpose(index(A1:H10,match(today(),A1:A10,0)))))
Then I find Places corresponding to these persons (I use filter function for it and then I use textjoin to keep them in single cell).
The formula is copied down as filter function does not accept a range and arrayformula as a filtering criterium.
My solution is available here:
https://docs.google.com/spreadsheets/d/1GTy_UaFP8LbA8OLnEhT_R_twpDCIWCuvQfBAigqtbR0/copy

I need to compare values between two sheets to find matching items

I need to compare two different sheets to find matching values between them.
In the first sheet, I have a list of order numbers and in the second one, I have a list that needs dispatching. Therefore, without scrolling through the sheet manually for the 1000+, I'd like to use a formula or conditional formatting in order to flag the values that are the same (or all of the different values) so I can simply copy and paste this into another sheet.
I have shared a link to a google sheet below if someone could help with this that would be very much appreciated.
Edit: The second sheet (on the google document) is the list of all orders and the first are the ones to be dispatched. I need to know which one's from the second sheet are missing from the first.
https://docs.google.com/spreadsheets/d/18vSBu9GzxK1UMCE2RrDyNSH6yi-FzTvuABsVw9r172Y/edit?usp=sharing
In second sheet in column B you could do:
=COUNTIF(Sheet1!A:A,A2)
IF the formula returns 0, it means that id number is not in your first sheet.

Using text from a cell in a formula in Google Sheets

I would like to use the text from a cell in a formula in Google Sheets.
I have a document with multiple sheets that a variety of people can edit with a H,M,L (high, medium, low) value from a drop-down list. Each person has their own tab in the Google Sheet.
I then have a dashboard that populates based on their choices of H,M,L. I know that I can use the formula =('Jay Delacruz'!C6) for example to populate a cell in another sheet by manually selecting the cells on the other sheet.
However, I am looking to make quite a few of these documents automatically with another Google Script that I am running that creates the individual sheets from a roster of names on the first tab.
My question is, is it possible to have a =('Jay Delacruz'!C6) type formula that instead of the sheet reference it can pull the name of the person from the roster, as this will match exactly the sheets that are automatically generated by the script I have running.
So I would essentially have a pre-populated dashboard of formulae that would become valid once the sheets are created with the names, as created by the other script.
If it makes it a little clearer, there is a link below to make a copy of the Sheet I am working with. All names were randomly generated, so don't reference any real people or data.
https://docs.google.com/spreadsheets/d/1NiXqko8SibD6VsfrnFcj7e7c99Hg-RoSlHVAYWb0E94/copy
Thank you in advance!
Liam
Try
=INDIRECT(C1&"!C6")
Also see here for more info on INDIRECT() function.

reference cell via two partial matches on another cell

I need to match two conditions on the cell Name and add the price information into cell price if both condition match. In other words, if Name contains both conditions, get the price. I tried different approaches using QUERY, SEARCH; FIND; VLOOKUP but I got stuck somewhere in the middle. Here's the example sheet (Google Spreadsheet solution preferred over Excel):
https://docs.google.com/spreadsheets/d/1zwG3_5Ctg_IZ1kI04Uee-qIvMrNQ4GmEwySmYcMKLfA/edit?usp=sharing
Maybe important: Both, the Name values as well as the whole reference table get pulled from other files dynamically. So I don't know anything concerning order or length of these columns in advance, not even if there are matches at all.
In addition to previous answer AND given the current set of data (in a Google spreadsheet), in B2 try:
=ArrayFormula(iferror(vlookup(regexreplace(A2:A; "[^A-Z]"; ""); {E2:E&F2:F\G2:G}; 2; 0)))
and see if that works ?
Based on your spreadsheet table:
you can try the following formula:
this formula works in excel not in google spreadsheets
=IFNA(INDEX($G$2:$G$6;MATCH(1;COUNTIFS(A2;"*"&$E$2:$E$100&"*";A2;"*"&$F$2:$F$100&"*");0));"NOT FOUND")
this is an array formula, so press ctrl+shift+enter to calculate the formula.
i think it will do the job.
here is the example file to download

Resources