I have a Google Spreadsheet with 3 sheets containing data from different countries (Country1, Country2, Country3) and a 4th sheet (Summary) that is supposed to append these together. The columns are the same in all sheets.
I know already that I can combine them like this:
=QUERY({Country1!A2:G;Country2!A2:G;Country3!A2:G}; "SELECT * WHERE Col1 IS NOT NULL")
However, I need a way to combine an arbitrary amount of sheets together, without modifying the formula. So, if Country4 gets added, this should be appended as well. How can I do that?
If it helps, I have a Settings sheet with a column that contains all the names of the countries (and therefore country sheet names). I have a script that dynamically generates new sheets if a country is added in the Settings sheet. If necessary, this script can also update the formula in the Summary sheet.
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Summary").getRange('A1').setValue(summaryQuery);But I was wondering if there is an easier/more effective method, without using scripts. - otherguySettingssheet withCountry1,Country2,Country3in columnA. - otherguyif you do not know the number of sheetsI really meanfor an arbitrary amount. Sorry for my poor explanation. I believe this formula will need to be generated with a script for an arbitrary number of Sheets. I can provide this script for you, if you like? - Rafa Guillermo