I have a spreadsheet that has a lot of sheets of data grouped by category. I have a main sheet that I want a user to be able to choose which categories of data to use, and it will pull that data into one long list.
Here is an example spreadsheet of what I want to do: LINK TO SHEET
I could combine all the data into one spreadsheet, but if I were to do that with the dataset I am working with, I would have tens of thousands of rows. So, having the data stored on separate sheets is preferred. I am open to having separate spreadsheets altogether if that will make it easier. Currently, I have tried Using INDIRECT and QUERY, but can only get the first sheet of data to show.
I would prefer to stick to normal functions, but could jump into appscript if I need to create a custom formula
I have tried using INDIRECT and CONCAT, and can get the first set of data, but not subsequent data. Also tried wrapping it in a query like this:
=QUERY({ARRAYFORMULA(INDIRECT(CONCAT(A2:A,"!a2:z100"))},"select * where Col1 is not null",1))
Splitting it up into separate spreadsheets, I was able to use the function:
=QUERY({ARRAYFORMULA(IMPORTRANGE(B2:B,"A1:Z10"))},"select * where Col1 is not null",1)
But it also would only pull the first set of data, not the subsequent rows.
All of this was me first attempting to get the information, not getting the information filtered by the sheets that were checked as well. I am pretty familiar with appscript as well and open to appscript solutions, but would prefer to stay away from it if possible.
You do not need additional column. Use REDUCE() with few other formula-
=REDUCE(HSTACK("Dataset Name","Data 1","Data 2","Data 3","Data 4"),FILTER(A2:A,B2:B=TRUE),
LAMBDA(x,y,VSTACK(x,QUERY(INDIRECT(y&"!A2:E"),"where A is not null"))))
Related
URL1, URL2, URL3 all contain one table each.
I am currently importing each in different sheets.
Is there anyway to import them continuously in the same spreadsheet?
Update1: The number of rows in tables vary everyday, so I have to do it manually. I would like to know if there is a way to combine two importhtml functions with query or concat?
Something like =importhtml (url1, table,2) & importhtml (url2, table,2)
Update2: I have attached sample file link here
https://docs.google.com/spreadsheets/d/1VdFMzRTwcaFAglGNpqvzGytdz_mqohtxGgAywKlLi0U/edit?usp=sharing
In A1 there's one table and in I1 there is another.
This is stock market data so it changes everyday. I would like to know if there is a way to combine the formulas?
EDIT
(following OP's request)
This worked perfectly. Is there anyway to loose the header row of the second table...
Please inclose the IMPORTHTML functions in a QUERY
={QUERY(IMPORTHTML("xxx","table",1), "where Col1 is not null",1);
QUERY(IMPORTHTML("yyy","table",1), "where Col1 is not null offset 1",0)}
Please notice that in the second QUERY we use offset 1",0.
This will eliminate the headers of the second table.
PRO TIP
Since you now have everything in queries, you can also take advantage of all the many, so very flexible query properties/clauses like select, order by, group-by etc.
I am currently importing each in different sheets, is there anyway to import them continuously in the same spreadsheet?
Most likely yes. It highly depends on the formulas you use and the structure of the tables.
If they all have the same amount of columns you can probably create an array like
={IMPORTHTML("xxx","table",1);
IMPORTHTML("yyy","table",1)}
IMPORTHTML("zzzz","table",1)}
The above formula will stack the tables one on top of the other.
(hard to give a definite answer without further info and expected results)
I am creating a home budget for myself in Google Sheets, working in Chrome on Windows 10. In the end, the budget will be composed of separate sheets for each month, containing tables for each Friday (payday) within that month. All such tables will follow a certain format and will pull arrays of budget data from an auxiliary sheet.
However, trial-and-error (mostly error) is abundant, and one quails at the thought of having to paste corrections across 52 tables. Is there any way to have each table emulate a formula set down in a template? For example, ideally, my template would contain something like:
=INDEX(IF(condition(relativeCell),namedRange1,namedRange2)
and the final product would pull that formula (with relative reference) to each table. If I discover a mistake or need to make a change, I can simply change the template, and all of the live tables would update their formulas.
Can this be done in Google Sheets?
Failing that, I already have a function that returns a cell's formula as string text. Can this be used to get the desired effect?
there is a formula called INDIRECT which does exactly that:
https://support.google.com/docs/answer/3093377?hl=en
I have a huge year of data and I cannot add it in 1 spreadsheet because of the limitation on the number of cells per workbook/spreadsheet so I separated the huge data into multiple files by month (January, February, March etc).
In my master file/spreadsheet I needed to use a formula to lookup some values from the master spreadsheet and the problem is that the tables to look into are now in multiple monthly spreadsheets. What is the best formula to look up values in multiple spreadsheets?
After googling for a while I don't have much options, I don't even know what the formula is for using Vlookup to find values in a separate spreadsheet instead of another tab. I tried importrange and it seem to still use the limit even though it's in a different spreadsheet I get error when trying to use it because the data is too large.
So you can use IMPORTRANGE to get the columns needed for the vlookup.
=VLOOKUP(D42,IMPORTRANGE("https://docs.google.com/spreadsheets/d/[sheet_id]","Sheet1!D:ZZ"),1,0)
It's not clear if you added the permission needed to access the other workbook when you use IMPORTRANGE
like this
You can also use IMPORTRANGE in the data parameter QUERY(data, query, [headers])
QUERY is awesome when you know your way around SQL. Google Visualization API Query Language
I have a main sheet in witch I copy it and create different versions, kind of like simulating different results.
But every time I want to change something in the main sheet, I have to go in all the other sheets I created and changed.
I don't know if it is possible, but the best way for me would be to create a formula like this:
copyFormula(Sheet1!V2) -> And bringed the exactly same result as if I had gone to Sheet1 copied V2 and pasted it this cell.
I tried to create this formula but failed consistently.
Thanks!!
What you need to do is to manipulate the properties of the sheets.
Here is a reference where you can create those actions.
The Sheets API allows you to create sheets, delete sheets, and control
their properties. The examples on this page illustrate how some common
sheet operations can be achieved with the API.
In these examples, the placeholders spreadsheetId and sheetId are
used to indicate where you would provide those IDs. The spreadsheet
ID can be discovered from the spreadsheet URL; the sheet ID can be
obtained from the spreadsheet.get method.
You can refer to this documentation on how you can read the formula you are needing in the entire sheets.
The Sheets API allows you to read values from cells, ranges, sets of
ranges and entire sheets. The examples on this page illustrate how
some common read operations can be achieved with the
spreadsheets.values collection of this API. You can also read
cell values using the spreadsheets.get method, but in most cases
using spreadsheets.values.get or
spreadsheets.values.batchGet is easier to use.
I have a URL in one cell which is the criterion for the IMPORTRANGE. e.g.:
=IMPORTRANGE(B2,"sheet1!$A$1")
I found a formula to collect it as criterion, but not in array version.
A sample can be found here.
I see you have column B filled with Spreadsheet Ids, and you are trying to execute
=ArrayFormula(IMPORTRANGE(B2:B,"sheet1!$A$1"))
Not every spreadsheet function supports arrays as argument. In particular, importrange does not. You need separate importrange formulas for separate spreadsheets you are importing.
Indeed, importing data from another spreadsheet is not a batch operation; each import has to be authorized by clicking a prompt the first time it's called. Also, it's a very slow operation; you will get a serious performance
hit if trying to import a lot of other spreadsheets.
Generally, if you find yourself doing a lot of importrange, it may be time to rethink the overall data organization.
While you cannot use IMPORTRANGE() in an arrayformula, as detailed in the other answer, you can use it in an array literal. In your case, for the first five cells in your column B that contain spreadsheet URLs:
={
IMPORTRANGE(B2,"sheet1!$A$1");
IMPORTRANGE(B3,"sheet1!$A$1");
IMPORTRANGE(B4,"sheet1!$A$1");
IMPORTRANGE(B5,"sheet1!$A$1");
IMPORTRANGE(B6,"sheet1!$A$1")
}
So you'll have to write IMPORTRANGE() multiple times and you can only use this technique if you know before how many sheets there are to import. But the advantage is that this also works where IMPORTRANGE() returns multiple rows each – in that case, copying the formulas down is no option, as IMPORTRANGE() creates an error in cases where its results would overwrite cell contents further down.