[{"data":1,"prerenderedAt":2376},["ShallowReactive",2],{"content-query-pqUJTJMNH9":3},[4,783,1505],{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"category":11,"date":12,"readingTime":13,"tags":14,"body":19,"_type":777,"_id":778,"_source":779,"_file":780,"_stem":781,"_extension":782},"\u002Fgoogle-sheets\u002Farrayformula-complete-guide","google-sheets",false,"","Google Sheets ARRAYFORMULA: Apply One Formula to an Entire Column","Learn how ARRAYFORMULA in Google Sheets lets a single formula process an entire column or range automatically, eliminating the need to drag formulas down and keeping data clean when new rows are added.","Google Sheets","2026-10-24",7,[15,11,16,17,18],"ARRAYFORMULA","automation","column formulas","Google Forms",{"type":20,"children":21,"toc":764},"root",[22,30,41,48,68,81,87,92,106,119,133,138,174,180,201,213,219,224,238,243,257,262,276,282,287,301,306,320,325,331,336,350,355,392,398,403,411,431,436,450,455,461,466,471,485,490,504,510,515,690,714,720,733,758],{"type":23,"tag":24,"props":25,"children":26},"element","p",{},[27],{"type":28,"value":29},"text","In a standard Google Sheet, if you want to apply a formula to 500 rows, you type it in the first cell and drag it down — or copy-paste it. This works, but it creates 500 separate formula cells. When new rows are added (from a Google Form submission, for example), the new rows have no formula.",{"type":23,"tag":24,"props":31,"children":32},{},[33,39],{"type":23,"tag":34,"props":35,"children":37},"code",{"className":36},[],[38],{"type":28,"value":15},{"type":28,"value":40}," solves this by processing an entire range with a single formula in a single cell.",{"type":23,"tag":42,"props":43,"children":45},"h2",{"id":44},"basic-syntax",[46],{"type":28,"value":47},"Basic Syntax",{"type":23,"tag":49,"props":50,"children":54},"pre",{"className":51,"code":52,"language":53,"meta":8,"style":8},"language-gsheets shiki shiki-themes github-dark","=ARRAYFORMULA(array_formula)\n","gsheets",[55],{"type":23,"tag":34,"props":56,"children":57},{"__ignoreMap":8},[58],{"type":23,"tag":59,"props":60,"children":63},"span",{"class":61,"line":62},"line",1,[64],{"type":23,"tag":59,"props":65,"children":66},{},[67],{"type":28,"value":52},{"type":23,"tag":24,"props":69,"children":70},{},[71,73,79],{"type":28,"value":72},"Where ",{"type":23,"tag":34,"props":74,"children":76},{"className":75},[],[77],{"type":28,"value":78},"array_formula",{"type":28,"value":80}," is any formula that should apply row-by-row across a range.",{"type":23,"tag":42,"props":82,"children":84},{"id":83},"simple-example-multiplication-across-a-column",[85],{"type":28,"value":86},"Simple Example: Multiplication Across a Column",{"type":23,"tag":24,"props":88,"children":89},{},[90],{"type":28,"value":91},"Without ARRAYFORMULA, you would put this in cell D2 and drag down to D100:",{"type":23,"tag":49,"props":93,"children":95},{"className":51,"code":94,"language":53,"meta":8,"style":8},"=B2*C2\n",[96],{"type":23,"tag":34,"props":97,"children":98},{"__ignoreMap":8},[99],{"type":23,"tag":59,"props":100,"children":101},{"class":61,"line":62},[102],{"type":23,"tag":59,"props":103,"children":104},{},[105],{"type":28,"value":94},{"type":23,"tag":24,"props":107,"children":108},{},[109,111,117],{"type":28,"value":110},"With ARRAYFORMULA, place this ",{"type":23,"tag":112,"props":113,"children":114},"strong",{},[115],{"type":28,"value":116},"only in cell D2",{"type":28,"value":118},":",{"type":23,"tag":49,"props":120,"children":122},{"className":51,"code":121,"language":53,"meta":8,"style":8},"=ARRAYFORMULA(B2:B*C2:C)\n",[123],{"type":23,"tag":34,"props":124,"children":125},{"__ignoreMap":8},[126],{"type":23,"tag":59,"props":127,"children":128},{"class":61,"line":62},[129],{"type":23,"tag":59,"props":130,"children":131},{},[132],{"type":28,"value":121},{"type":23,"tag":24,"props":134,"children":135},{},[136],{"type":28,"value":137},"The result fills D2:D automatically for every row that has data in column B and C. As new rows are added, the result column updates immediately.",{"type":23,"tag":139,"props":140,"children":141},"blockquote",{},[142],{"type":23,"tag":24,"props":143,"children":144},{},[145,150,152,157,159,164,166,172],{"type":23,"tag":112,"props":146,"children":147},{},[148],{"type":28,"value":149},"Keyboard shortcut:",{"type":28,"value":151}," In a formula, press ",{"type":23,"tag":112,"props":153,"children":154},{},[155],{"type":28,"value":156},"Ctrl+Shift+Enter",{"type":28,"value":158}," (Windows) or ",{"type":23,"tag":112,"props":160,"children":161},{},[162],{"type":28,"value":163},"Cmd+Shift+Enter",{"type":28,"value":165}," (Mac) to automatically wrap the formula in ",{"type":23,"tag":34,"props":167,"children":169},{"className":168},[],[170],{"type":28,"value":171},"ARRAYFORMULA()",{"type":28,"value":173},".",{"type":23,"tag":42,"props":175,"children":177},{"id":176},"why-open-ended-ranges-work-here",[178],{"type":28,"value":179},"Why Open-Ended Ranges Work Here",{"type":23,"tag":24,"props":181,"children":182},{},[183,185,191,193,199],{"type":28,"value":184},"Notice ",{"type":23,"tag":34,"props":186,"children":188},{"className":187},[],[189],{"type":28,"value":190},"B2:B",{"type":28,"value":192}," instead of ",{"type":23,"tag":34,"props":194,"children":196},{"className":195},[],[197],{"type":28,"value":198},"B2:B100",{"type":28,"value":200},". Open-ended ranges are safe inside ARRAYFORMULA because the formula only computes values for rows with actual data — blank rows produce blank outputs, not errors or zeros.",{"type":23,"tag":24,"props":202,"children":203},{},[204,206,211],{"type":28,"value":205},"However, avoid open-ended ranges ",{"type":23,"tag":112,"props":207,"children":208},{},[209],{"type":28,"value":210},"outside",{"type":28,"value":212}," ARRAYFORMULA, as they force the entire column to calculate.",{"type":23,"tag":42,"props":214,"children":216},{"id":215},"applying-text-functions-to-a-whole-column",[217],{"type":28,"value":218},"Applying Text Functions to a Whole Column",{"type":23,"tag":24,"props":220,"children":221},{},[222],{"type":28,"value":223},"Trim whitespace from an entire column of imported names:",{"type":23,"tag":49,"props":225,"children":227},{"className":51,"code":226,"language":53,"meta":8,"style":8},"=ARRAYFORMULA(TRIM(A2:A))\n",[228],{"type":23,"tag":34,"props":229,"children":230},{"__ignoreMap":8},[231],{"type":23,"tag":59,"props":232,"children":233},{"class":61,"line":62},[234],{"type":23,"tag":59,"props":235,"children":236},{},[237],{"type":28,"value":226},{"type":23,"tag":24,"props":239,"children":240},{},[241],{"type":28,"value":242},"Combine first and last name columns:",{"type":23,"tag":49,"props":244,"children":246},{"className":51,"code":245,"language":53,"meta":8,"style":8},"=ARRAYFORMULA(B2:B&\" \"&C2:C)\n",[247],{"type":23,"tag":34,"props":248,"children":249},{"__ignoreMap":8},[250],{"type":23,"tag":59,"props":251,"children":252},{"class":61,"line":62},[253],{"type":23,"tag":59,"props":254,"children":255},{},[256],{"type":28,"value":245},{"type":23,"tag":24,"props":258,"children":259},{},[260],{"type":28,"value":261},"Convert all entries to uppercase:",{"type":23,"tag":49,"props":263,"children":265},{"className":51,"code":264,"language":53,"meta":8,"style":8},"=ARRAYFORMULA(UPPER(D2:D))\n",[266],{"type":23,"tag":34,"props":267,"children":268},{"__ignoreMap":8},[269],{"type":23,"tag":59,"props":270,"children":271},{"class":61,"line":62},[272],{"type":23,"tag":59,"props":273,"children":274},{},[275],{"type":28,"value":264},{"type":23,"tag":42,"props":277,"children":279},{"id":278},"using-if-inside-arrayformula",[280],{"type":28,"value":281},"Using IF Inside ARRAYFORMULA",{"type":23,"tag":24,"props":283,"children":284},{},[285],{"type":28,"value":286},"You can combine IF with ARRAYFORMULA to add conditional logic across a whole column. Flag any revenue below 1000 as \"Low\":",{"type":23,"tag":49,"props":288,"children":290},{"className":51,"code":289,"language":53,"meta":8,"style":8},"=ARRAYFORMULA(IF(D2:D\u003C1000, \"Low\", \"OK\"))\n",[291],{"type":23,"tag":34,"props":292,"children":293},{"__ignoreMap":8},[294],{"type":23,"tag":59,"props":295,"children":296},{"class":61,"line":62},[297],{"type":23,"tag":59,"props":298,"children":299},{},[300],{"type":28,"value":289},{"type":23,"tag":24,"props":302,"children":303},{},[304],{"type":28,"value":305},"Add a blank check to avoid filling empty rows with \"OK\":",{"type":23,"tag":49,"props":307,"children":309},{"className":51,"code":308,"language":53,"meta":8,"style":8},"=ARRAYFORMULA(IF(D2:D=\"\", \"\", IF(D2:D\u003C1000, \"Low\", \"OK\")))\n",[310],{"type":23,"tag":34,"props":311,"children":312},{"__ignoreMap":8},[313],{"type":23,"tag":59,"props":314,"children":315},{"class":61,"line":62},[316],{"type":23,"tag":59,"props":317,"children":318},{},[319],{"type":28,"value":308},{"type":23,"tag":24,"props":321,"children":322},{},[323],{"type":28,"value":324},"This pattern is essential — without the blank check, ARRAYFORMULA writes \"OK\" in every empty row down to the sheet's last row (row 1000 by default).",{"type":23,"tag":42,"props":326,"children":328},{"id":327},"lookup-functions-inside-arrayformula",[329],{"type":28,"value":330},"Lookup Functions Inside ARRAYFORMULA",{"type":23,"tag":24,"props":332,"children":333},{},[334],{"type":28,"value":335},"Use VLOOKUP across an entire column with ARRAYFORMULA:",{"type":23,"tag":49,"props":337,"children":339},{"className":51,"code":338,"language":53,"meta":8,"style":8},"=ARRAYFORMULA(VLOOKUP(A2:A, Products!A:B, 2, FALSE))\n",[340],{"type":23,"tag":34,"props":341,"children":342},{"__ignoreMap":8},[343],{"type":23,"tag":59,"props":344,"children":345},{"class":61,"line":62},[346],{"type":23,"tag":59,"props":347,"children":348},{},[349],{"type":28,"value":338},{"type":23,"tag":24,"props":351,"children":352},{},[353],{"type":28,"value":354},"This looks up every value in column A against the Products sheet and returns the matching result — all in one formula.",{"type":23,"tag":139,"props":356,"children":357},{},[358],{"type":23,"tag":24,"props":359,"children":360},{},[361,366,368,374,376,382,384,390],{"type":23,"tag":112,"props":362,"children":363},{},[364],{"type":28,"value":365},"Note:",{"type":28,"value":367}," ",{"type":23,"tag":34,"props":369,"children":371},{"className":370},[],[372],{"type":28,"value":373},"XLOOKUP",{"type":28,"value":375}," does not work inside ARRAYFORMULA. Use ",{"type":23,"tag":34,"props":377,"children":379},{"className":378},[],[380],{"type":28,"value":381},"VLOOKUP",{"type":28,"value":383}," or ",{"type":23,"tag":34,"props":385,"children":387},{"className":386},[],[388],{"type":28,"value":389},"INDEX\u002FMATCH",{"type":28,"value":391}," for array-based lookups in Google Sheets.",{"type":23,"tag":42,"props":393,"children":395},{"id":394},"the-google-forms-automation-use-case",[396],{"type":28,"value":397},"The Google Forms Automation Use Case",{"type":23,"tag":24,"props":399,"children":400},{},[401],{"type":28,"value":402},"When a Google Form submits responses to a Sheet, new rows are added at the bottom. Any formulas in adjacent columns stop one row above the new data — unless you use ARRAYFORMULA.",{"type":23,"tag":24,"props":404,"children":405},{},[406],{"type":23,"tag":112,"props":407,"children":408},{},[409],{"type":28,"value":410},"Best practices for Google Forms response sheets:",{"type":23,"tag":412,"props":413,"children":414},"ol",{},[415,421,426],{"type":23,"tag":416,"props":417,"children":418},"li",{},[419],{"type":28,"value":420},"Put all calculation formulas at the top of their column (row 2) as ARRAYFORMULA formulas.",{"type":23,"tag":416,"props":422,"children":423},{},[424],{"type":28,"value":425},"Lock the header row.",{"type":23,"tag":416,"props":427,"children":428},{},[429],{"type":28,"value":430},"Do not put any formulas in individual response rows.",{"type":23,"tag":24,"props":432,"children":433},{},[434],{"type":28,"value":435},"Example: Auto-calculate response age in days:",{"type":23,"tag":49,"props":437,"children":439},{"className":51,"code":438,"language":53,"meta":8,"style":8},"=ARRAYFORMULA(IF(A2:A=\"\", \"\", TODAY()-A2:A))\n",[440],{"type":23,"tag":34,"props":441,"children":442},{"__ignoreMap":8},[443],{"type":23,"tag":59,"props":444,"children":445},{"class":61,"line":62},[446],{"type":23,"tag":59,"props":447,"children":448},{},[449],{"type":28,"value":438},{"type":23,"tag":24,"props":451,"children":452},{},[453],{"type":28,"value":454},"Column A contains the timestamp from Form submissions. This formula shows how many days ago each response arrived.",{"type":23,"tag":42,"props":456,"children":458},{"id":457},"arrayformula-with-sumif-and-countif-for-row-level-summaries",[459],{"type":28,"value":460},"ARRAYFORMULA with SUMIF and COUNTIF for Row-Level Summaries",{"type":23,"tag":24,"props":462,"children":463},{},[464],{"type":28,"value":465},"ARRAYFORMULA doesn't work with functions that already return single values (like SUM of a range). But it works well with SUMIF and COUNTIF where the criteria changes per row.",{"type":23,"tag":24,"props":467,"children":468},{},[469],{"type":28,"value":470},"Count how many times each name in column A appears in the full list:",{"type":23,"tag":49,"props":472,"children":474},{"className":51,"code":473,"language":53,"meta":8,"style":8},"=ARRAYFORMULA(COUNTIF(A2:A, A2:A))\n",[475],{"type":23,"tag":34,"props":476,"children":477},{"__ignoreMap":8},[478],{"type":23,"tag":59,"props":479,"children":480},{"class":61,"line":62},[481],{"type":23,"tag":59,"props":482,"children":483},{},[484],{"type":28,"value":473},{"type":23,"tag":24,"props":486,"children":487},{},[488],{"type":28,"value":489},"Sum all revenue where the region matches the value in column B for each row:",{"type":23,"tag":49,"props":491,"children":493},{"className":51,"code":492,"language":53,"meta":8,"style":8},"=ARRAYFORMULA(SUMIF(B2:B, B2:B, D2:D))\n",[494],{"type":23,"tag":34,"props":495,"children":496},{"__ignoreMap":8},[497],{"type":23,"tag":59,"props":498,"children":499},{"class":61,"line":62},[500],{"type":23,"tag":59,"props":501,"children":502},{},[503],{"type":28,"value":492},{"type":23,"tag":42,"props":505,"children":507},{"id":506},"compatibility-matrix",[508],{"type":28,"value":509},"Compatibility Matrix",{"type":23,"tag":24,"props":511,"children":512},{},[513],{"type":28,"value":514},"Some functions handle arrays natively and do not need ARRAYFORMULA, while others are incompatible:",{"type":23,"tag":516,"props":517,"children":518},"table",{},[519,539],{"type":23,"tag":520,"props":521,"children":522},"thead",{},[523],{"type":23,"tag":524,"props":525,"children":526},"tr",{},[527,534],{"type":23,"tag":528,"props":529,"children":531},"th",{"align":530},"left",[532],{"type":28,"value":533},"Works with ARRAYFORMULA",{"type":23,"tag":528,"props":535,"children":536},{"align":530},[537],{"type":28,"value":538},"Does NOT work",{"type":23,"tag":540,"props":541,"children":542},"tbody",{},[543,585,620,655],{"type":23,"tag":524,"props":544,"children":545},{},[546,577],{"type":23,"tag":547,"props":548,"children":549},"td",{"align":530},[550,556,558,563,564,570,571],{"type":23,"tag":34,"props":551,"children":553},{"className":552},[],[554],{"type":28,"value":555},"IF",{"type":28,"value":557},", ",{"type":23,"tag":34,"props":559,"children":561},{"className":560},[],[562],{"type":28,"value":381},{"type":28,"value":557},{"type":23,"tag":34,"props":565,"children":567},{"className":566},[],[568],{"type":28,"value":569},"TRIM",{"type":28,"value":557},{"type":23,"tag":34,"props":572,"children":574},{"className":573},[],[575],{"type":28,"value":576},"LEN",{"type":23,"tag":547,"props":578,"children":579},{"align":530},[580],{"type":23,"tag":34,"props":581,"children":583},{"className":582},[],[584],{"type":28,"value":373},{"type":23,"tag":524,"props":586,"children":587},{},[588,604],{"type":23,"tag":547,"props":589,"children":590},{"align":530},[591,597,598],{"type":23,"tag":34,"props":592,"children":594},{"className":593},[],[595],{"type":28,"value":596},"COUNTIF",{"type":28,"value":557},{"type":23,"tag":34,"props":599,"children":601},{"className":600},[],[602],{"type":28,"value":603},"SUMIF",{"type":23,"tag":547,"props":605,"children":606},{"align":530},[607,613,614],{"type":23,"tag":34,"props":608,"children":610},{"className":609},[],[611],{"type":28,"value":612},"SORT",{"type":28,"value":557},{"type":23,"tag":34,"props":615,"children":617},{"className":616},[],[618],{"type":28,"value":619},"UNIQUE",{"type":23,"tag":524,"props":621,"children":622},{},[623,646],{"type":23,"tag":547,"props":624,"children":625},{"align":530},[626,632,633,639,640],{"type":23,"tag":34,"props":627,"children":629},{"className":628},[],[630],{"type":28,"value":631},"LEFT",{"type":28,"value":557},{"type":23,"tag":34,"props":634,"children":636},{"className":635},[],[637],{"type":28,"value":638},"RIGHT",{"type":28,"value":557},{"type":23,"tag":34,"props":641,"children":643},{"className":642},[],[644],{"type":28,"value":645},"MID",{"type":23,"tag":547,"props":647,"children":648},{"align":530},[649],{"type":23,"tag":34,"props":650,"children":652},{"className":651},[],[653],{"type":28,"value":654},"FILTER",{"type":23,"tag":524,"props":656,"children":657},{},[658,681],{"type":23,"tag":547,"props":659,"children":660},{"align":530},[661,667,668,674,675],{"type":23,"tag":34,"props":662,"children":664},{"className":663},[],[665],{"type":28,"value":666},"UPPER",{"type":28,"value":557},{"type":23,"tag":34,"props":669,"children":671},{"className":670},[],[672],{"type":28,"value":673},"LOWER",{"type":28,"value":557},{"type":23,"tag":34,"props":676,"children":678},{"className":677},[],[679],{"type":28,"value":680},"TEXT",{"type":23,"tag":547,"props":682,"children":683},{"align":530},[684],{"type":23,"tag":34,"props":685,"children":687},{"className":686},[],[688],{"type":28,"value":689},"TRANSPOSE",{"type":23,"tag":24,"props":691,"children":692},{},[693,695,700,701,706,707,712],{"type":28,"value":694},"For ",{"type":23,"tag":34,"props":696,"children":698},{"className":697},[],[699],{"type":28,"value":612},{"type":28,"value":557},{"type":23,"tag":34,"props":702,"children":704},{"className":703},[],[705],{"type":28,"value":619},{"type":28,"value":557},{"type":23,"tag":34,"props":708,"children":710},{"className":709},[],[711],{"type":28,"value":654},{"type":28,"value":713}," — these are already array-native functions in Google Sheets and return dynamic ranges on their own.",{"type":23,"tag":42,"props":715,"children":717},{"id":716},"performance-notes",[718],{"type":28,"value":719},"Performance Notes",{"type":23,"tag":24,"props":721,"children":722},{},[723,725,731],{"type":28,"value":724},"ARRAYFORMULA with open-ended ranges (",{"type":23,"tag":34,"props":726,"children":728},{"className":727},[],[729],{"type":28,"value":730},"A2:A",{"type":28,"value":732},") calculates for the entire available sheet height. In sheets with many ARRAYFORMULA columns and large datasets (10,000+ rows), this can slow down the sheet. To improve performance:",{"type":23,"tag":734,"props":735,"children":736},"ul",{},[737,748,753],{"type":23,"tag":416,"props":738,"children":739},{},[740,742],{"type":28,"value":741},"Bound the range to the actual data length: ",{"type":23,"tag":34,"props":743,"children":745},{"className":744},[],[746],{"type":28,"value":747},"A2:A1000",{"type":23,"tag":416,"props":749,"children":750},{},[751],{"type":28,"value":752},"Use QUERY for complex aggregations instead of multiple nested ARRAYFORMULAs",{"type":23,"tag":416,"props":754,"children":755},{},[756],{"type":28,"value":757},"Avoid multiple nested ARRAYFORMULA inside each other — they recalculate the entire range at each level",{"type":23,"tag":759,"props":760,"children":761},"style",{},[762],{"type":28,"value":763},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":8,"searchDepth":765,"depth":765,"links":766},2,[767,768,769,770,771,772,773,774,775,776],{"id":44,"depth":765,"text":47},{"id":83,"depth":765,"text":86},{"id":176,"depth":765,"text":179},{"id":215,"depth":765,"text":218},{"id":278,"depth":765,"text":281},{"id":327,"depth":765,"text":330},{"id":394,"depth":765,"text":397},{"id":457,"depth":765,"text":460},{"id":506,"depth":765,"text":509},{"id":716,"depth":765,"text":719},"markdown","content:google-sheets:arrayformula-complete-guide.md","content","google-sheets\u002Farrayformula-complete-guide.md","google-sheets\u002Farrayformula-complete-guide","md",{"_path":784,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":785,"description":786,"category":11,"date":12,"readingTime":13,"tags":787,"body":791,"_type":777,"_id":1502,"_source":779,"_file":1503,"_stem":1504,"_extension":782},"\u002Fgoogle-sheets\u002Fimportrange-guide","IMPORTRANGE in Google Sheets: Share Data Between Spreadsheets Safely","Learn how to use IMPORTRANGE to pull data between Google Sheets files, manage permissions, combine with QUERY for filtered imports, handle refresh delays, and avoid common errors.",[788,11,789,790],"IMPORTRANGE","collaboration","linked spreadsheets",{"type":20,"children":792,"toc":1488},[793,803,807,821,851,857,862,876,893,906,912,933,947,952,958,971,985,997,1003,1008,1013,1063,1118,1124,1129,1143,1148,1154,1159,1199,1206,1211,1225,1231,1244,1282,1287,1293,1410,1416,1484],{"type":23,"tag":24,"props":794,"children":795},{},[796,801],{"type":23,"tag":34,"props":797,"children":799},{"className":798},[],[800],{"type":28,"value":788},{"type":28,"value":802}," is Google Sheets' built-in connector for pulling data from one spreadsheet into another. Instead of manually copying data between files — creating out-of-sync duplicates — IMPORTRANGE creates a live link that updates whenever the source sheet changes.",{"type":23,"tag":42,"props":804,"children":805},{"id":44},[806],{"type":28,"value":47},{"type":23,"tag":49,"props":808,"children":810},{"className":51,"code":809,"language":53,"meta":8,"style":8},"=IMPORTRANGE(spreadsheet_url, range_string)\n",[811],{"type":23,"tag":34,"props":812,"children":813},{"__ignoreMap":8},[814],{"type":23,"tag":59,"props":815,"children":816},{"class":61,"line":62},[817],{"type":23,"tag":59,"props":818,"children":819},{},[820],{"type":28,"value":809},{"type":23,"tag":734,"props":822,"children":823},{},[824,834],{"type":23,"tag":416,"props":825,"children":826},{},[827,832],{"type":23,"tag":112,"props":828,"children":829},{},[830],{"type":28,"value":831},"spreadsheet_url",{"type":28,"value":833}," — The full URL of the source spreadsheet, enclosed in double quotes.",{"type":23,"tag":416,"props":835,"children":836},{},[837,842,844,850],{"type":23,"tag":112,"props":838,"children":839},{},[840],{"type":28,"value":841},"range_string",{"type":28,"value":843}," — A text string specifying the sheet name and range, e.g., ",{"type":23,"tag":34,"props":845,"children":847},{"className":846},[],[848],{"type":28,"value":849},"\"Sheet1!A1:D100\"",{"type":28,"value":173},{"type":23,"tag":42,"props":852,"children":854},{"id":853},"your-first-importrange-formula",[855],{"type":28,"value":856},"Your First IMPORTRANGE Formula",{"type":23,"tag":24,"props":858,"children":859},{},[860],{"type":28,"value":861},"Suppose you want to pull inventory data from another file. Copy the full URL from the browser address bar of the source file:",{"type":23,"tag":49,"props":863,"children":865},{"className":51,"code":864,"language":53,"meta":8,"style":8},"=IMPORTRANGE(\"https:\u002F\u002Fdocs.google.com\u002Fspreadsheets\u002Fd\u002F1aBcDeFgHiJkLmNoPqRsTuVwXyZ\u002Fedit\", \"Inventory!A1:E200\")\n",[866],{"type":23,"tag":34,"props":867,"children":868},{"__ignoreMap":8},[869],{"type":23,"tag":59,"props":870,"children":871},{"class":61,"line":62},[872],{"type":23,"tag":59,"props":873,"children":874},{},[875],{"type":28,"value":864},{"type":23,"tag":24,"props":877,"children":878},{},[879,884,886,891],{"type":23,"tag":112,"props":880,"children":881},{},[882],{"type":28,"value":883},"On first use",{"type":28,"value":885},", Google Sheets will display an ",{"type":23,"tag":112,"props":887,"children":888},{},[889],{"type":28,"value":890},"\"Allow access\"",{"type":28,"value":892}," prompt. You must click it once to grant your destination file read permission to the source file. After granting access, the formula loads the data.",{"type":23,"tag":139,"props":894,"children":895},{},[896],{"type":23,"tag":24,"props":897,"children":898},{},[899,904],{"type":23,"tag":112,"props":900,"children":901},{},[902],{"type":28,"value":903},"Security note:",{"type":28,"value":905}," Access is granted at the file level — any formula in your file can now read from that source URL. Revoking access requires the source file owner to manage permissions from the source side.",{"type":23,"tag":42,"props":907,"children":909},{"id":908},"using-the-spreadsheet-id-instead-of-the-full-url",[910],{"type":28,"value":911},"Using the Spreadsheet ID Instead of the Full URL",{"type":23,"tag":24,"props":913,"children":914},{},[915,917,923,925,931],{"type":28,"value":916},"You can shorten the formula by using only the spreadsheet ID — the long string of characters between ",{"type":23,"tag":34,"props":918,"children":920},{"className":919},[],[921],{"type":28,"value":922},"\u002Fd\u002F",{"type":28,"value":924}," and ",{"type":23,"tag":34,"props":926,"children":928},{"className":927},[],[929],{"type":28,"value":930},"\u002Fedit",{"type":28,"value":932}," in the URL:",{"type":23,"tag":49,"props":934,"children":936},{"className":51,"code":935,"language":53,"meta":8,"style":8},"=IMPORTRANGE(\"1aBcDeFgHiJkLmNoPqRsTuVwXyZ\", \"Inventory!A1:E200\")\n",[937],{"type":23,"tag":34,"props":938,"children":939},{"__ignoreMap":8},[940],{"type":23,"tag":59,"props":941,"children":942},{"class":61,"line":62},[943],{"type":23,"tag":59,"props":944,"children":945},{},[946],{"type":28,"value":935},{"type":23,"tag":24,"props":948,"children":949},{},[950],{"type":28,"value":951},"Both formats work identically. The ID form is cleaner and more portable.",{"type":23,"tag":42,"props":953,"children":955},{"id":954},"storing-the-url-in-a-cell",[956],{"type":28,"value":957},"Storing the URL in a Cell",{"type":23,"tag":24,"props":959,"children":960},{},[961,963,969],{"type":28,"value":962},"For maintainability, store the spreadsheet URL or ID in a dedicated cell (e.g., cell ",{"type":23,"tag":34,"props":964,"children":966},{"className":965},[],[967],{"type":28,"value":968},"A1",{"type":28,"value":970},"):",{"type":23,"tag":49,"props":972,"children":974},{"className":51,"code":973,"language":53,"meta":8,"style":8},"=IMPORTRANGE(A1, \"Inventory!A1:E200\")\n",[975],{"type":23,"tag":34,"props":976,"children":977},{"__ignoreMap":8},[978],{"type":23,"tag":59,"props":979,"children":980},{"class":61,"line":62},[981],{"type":23,"tag":59,"props":982,"children":983},{},[984],{"type":28,"value":973},{"type":23,"tag":24,"props":986,"children":987},{},[988,990,995],{"type":28,"value":989},"When the source file changes, update only ",{"type":23,"tag":34,"props":991,"children":993},{"className":992},[],[994],{"type":28,"value":968},{"type":28,"value":996}," rather than hunting through every IMPORTRANGE formula.",{"type":23,"tag":42,"props":998,"children":1000},{"id":999},"combining-importrange-with-query",[1001],{"type":28,"value":1002},"Combining IMPORTRANGE with QUERY",{"type":23,"tag":24,"props":1004,"children":1005},{},[1006],{"type":28,"value":1007},"One of the most powerful spreadsheet patterns is importing data AND filtering\u002Fsorting it in the same formula.",{"type":23,"tag":24,"props":1009,"children":1010},{},[1011],{"type":28,"value":1012},"Pull only rows from the North region, sorted by revenue descending:",{"type":23,"tag":49,"props":1014,"children":1016},{"className":51,"code":1015,"language":53,"meta":8,"style":8},"=QUERY(\n  IMPORTRANGE(\"spreadsheet_id\", \"Sales!A1:F500\"),\n  \"SELECT Col1, Col2, Col4 WHERE Col2 = 'North' ORDER BY Col4 DESC\",\n  1\n)\n",[1017],{"type":23,"tag":34,"props":1018,"children":1019},{"__ignoreMap":8},[1020,1028,1036,1045,1054],{"type":23,"tag":59,"props":1021,"children":1022},{"class":61,"line":62},[1023],{"type":23,"tag":59,"props":1024,"children":1025},{},[1026],{"type":28,"value":1027},"=QUERY(\n",{"type":23,"tag":59,"props":1029,"children":1030},{"class":61,"line":765},[1031],{"type":23,"tag":59,"props":1032,"children":1033},{},[1034],{"type":28,"value":1035},"  IMPORTRANGE(\"spreadsheet_id\", \"Sales!A1:F500\"),\n",{"type":23,"tag":59,"props":1037,"children":1039},{"class":61,"line":1038},3,[1040],{"type":23,"tag":59,"props":1041,"children":1042},{},[1043],{"type":28,"value":1044},"  \"SELECT Col1, Col2, Col4 WHERE Col2 = 'North' ORDER BY Col4 DESC\",\n",{"type":23,"tag":59,"props":1046,"children":1048},{"class":61,"line":1047},4,[1049],{"type":23,"tag":59,"props":1050,"children":1051},{},[1052],{"type":28,"value":1053},"  1\n",{"type":23,"tag":59,"props":1055,"children":1057},{"class":61,"line":1056},5,[1058],{"type":23,"tag":59,"props":1059,"children":1060},{},[1061],{"type":28,"value":1062},")\n",{"type":23,"tag":139,"props":1064,"children":1065},{},[1066],{"type":23,"tag":24,"props":1067,"children":1068},{},[1069,1073,1075,1081,1082,1088,1089,1095,1097,1103,1104,1110,1111,1117],{"type":23,"tag":112,"props":1070,"children":1071},{},[1072],{"type":28,"value":365},{"type":28,"value":1074}," Because IMPORTRANGE returns a virtual array, you must reference columns using ",{"type":23,"tag":34,"props":1076,"children":1078},{"className":1077},[],[1079],{"type":28,"value":1080},"Col1",{"type":28,"value":557},{"type":23,"tag":34,"props":1083,"children":1085},{"className":1084},[],[1086],{"type":28,"value":1087},"Col2",{"type":28,"value":557},{"type":23,"tag":34,"props":1090,"children":1092},{"className":1091},[],[1093],{"type":28,"value":1094},"Col3",{"type":28,"value":1096}," notation rather than sheet letters ",{"type":23,"tag":34,"props":1098,"children":1100},{"className":1099},[],[1101],{"type":28,"value":1102},"A",{"type":28,"value":557},{"type":23,"tag":34,"props":1105,"children":1107},{"className":1106},[],[1108],{"type":28,"value":1109},"B",{"type":28,"value":557},{"type":23,"tag":34,"props":1112,"children":1114},{"className":1113},[],[1115],{"type":28,"value":1116},"C",{"type":28,"value":173},{"type":23,"tag":42,"props":1119,"children":1121},{"id":1120},"pulling-data-from-multiple-sheets-in-one-file",[1122],{"type":28,"value":1123},"Pulling Data from Multiple Sheets in One File",{"type":23,"tag":24,"props":1125,"children":1126},{},[1127],{"type":28,"value":1128},"To import from a specific tab, include the tab name followed by an exclamation mark:",{"type":23,"tag":49,"props":1130,"children":1132},{"className":51,"code":1131,"language":53,"meta":8,"style":8},"=IMPORTRANGE(\"spreadsheet_id\", \"January 2024!A1:D100\")\n",[1133],{"type":23,"tag":34,"props":1134,"children":1135},{"__ignoreMap":8},[1136],{"type":23,"tag":59,"props":1137,"children":1138},{"class":61,"line":62},[1139],{"type":23,"tag":59,"props":1140,"children":1141},{},[1142],{"type":28,"value":1131},{"type":23,"tag":24,"props":1144,"children":1145},{},[1146],{"type":28,"value":1147},"Use the exact tab name as it appears in the source file.",{"type":23,"tag":42,"props":1149,"children":1151},{"id":1150},"performance-considerations",[1152],{"type":28,"value":1153},"Performance Considerations",{"type":23,"tag":24,"props":1155,"children":1156},{},[1157],{"type":28,"value":1158},"IMPORTRANGE has known operational characteristics:",{"type":23,"tag":734,"props":1160,"children":1161},{},[1162,1179,1189],{"type":23,"tag":416,"props":1163,"children":1164},{},[1165,1170,1172,1177],{"type":23,"tag":112,"props":1166,"children":1167},{},[1168],{"type":28,"value":1169},"Refresh delay:",{"type":28,"value":1171}," Changes in the source file may take ",{"type":23,"tag":112,"props":1173,"children":1174},{},[1175],{"type":28,"value":1176},"a few minutes",{"type":28,"value":1178}," to appear in the destination. It is not instantaneous.",{"type":23,"tag":416,"props":1180,"children":1181},{},[1182,1187],{"type":23,"tag":112,"props":1183,"children":1184},{},[1185],{"type":28,"value":1186},"Cell limits:",{"type":28,"value":1188}," Google recommends keeping IMPORTRANGE results under 100,000 cells per formula. Large imports cause significant loading time.",{"type":23,"tag":416,"props":1190,"children":1191},{},[1192,1197],{"type":23,"tag":112,"props":1193,"children":1194},{},[1195],{"type":28,"value":1196},"Recalculation:",{"type":28,"value":1198}," Every time the destination file opens, IMPORTRANGE re-fetches data, which can slow initial load.",{"type":23,"tag":1200,"props":1201,"children":1203},"h3",{"id":1202},"reducing-overhead",[1204],{"type":28,"value":1205},"Reducing Overhead",{"type":23,"tag":24,"props":1207,"children":1208},{},[1209],{"type":28,"value":1210},"Instead of importing all columns, import only the columns you need:",{"type":23,"tag":49,"props":1212,"children":1214},{"className":51,"code":1213,"language":53,"meta":8,"style":8},"=QUERY(IMPORTRANGE(\"id\",\"Data!A:Z\"), \"SELECT Col1, Col3, Col6\", 1)\n",[1215],{"type":23,"tag":34,"props":1216,"children":1217},{"__ignoreMap":8},[1218],{"type":23,"tag":59,"props":1219,"children":1220},{"class":61,"line":62},[1221],{"type":23,"tag":59,"props":1222,"children":1223},{},[1224],{"type":28,"value":1213},{"type":23,"tag":42,"props":1226,"children":1228},{"id":1227},"stacking-multiple-importrange-results-with-vstack",[1229],{"type":28,"value":1230},"Stacking Multiple IMPORTRANGE Results with VSTACK",{"type":23,"tag":24,"props":1232,"children":1233},{},[1234,1236,1242],{"type":28,"value":1235},"Google Sheets supports ",{"type":23,"tag":34,"props":1237,"children":1239},{"className":1238},[],[1240],{"type":28,"value":1241},"VSTACK",{"type":28,"value":1243}," to combine multiple IMPORTRANGE arrays vertically:",{"type":23,"tag":49,"props":1245,"children":1247},{"className":51,"code":1246,"language":53,"meta":8,"style":8},"=VSTACK(\n  IMPORTRANGE(\"file1_id\", \"Sheet1!A2:D100\"),\n  IMPORTRANGE(\"file2_id\", \"Sheet1!A2:D100\")\n)\n",[1248],{"type":23,"tag":34,"props":1249,"children":1250},{"__ignoreMap":8},[1251,1259,1267,1275],{"type":23,"tag":59,"props":1252,"children":1253},{"class":61,"line":62},[1254],{"type":23,"tag":59,"props":1255,"children":1256},{},[1257],{"type":28,"value":1258},"=VSTACK(\n",{"type":23,"tag":59,"props":1260,"children":1261},{"class":61,"line":765},[1262],{"type":23,"tag":59,"props":1263,"children":1264},{},[1265],{"type":28,"value":1266},"  IMPORTRANGE(\"file1_id\", \"Sheet1!A2:D100\"),\n",{"type":23,"tag":59,"props":1268,"children":1269},{"class":61,"line":1038},[1270],{"type":23,"tag":59,"props":1271,"children":1272},{},[1273],{"type":28,"value":1274},"  IMPORTRANGE(\"file2_id\", \"Sheet1!A2:D100\")\n",{"type":23,"tag":59,"props":1276,"children":1277},{"class":61,"line":1047},[1278],{"type":23,"tag":59,"props":1279,"children":1280},{},[1281],{"type":28,"value":1062},{"type":23,"tag":24,"props":1283,"children":1284},{},[1285],{"type":28,"value":1286},"This creates a single unified table from multiple source files — ideal for consolidating monthly files or regional branch reports.",{"type":23,"tag":42,"props":1288,"children":1290},{"id":1289},"common-errors-and-solutions",[1291],{"type":28,"value":1292},"Common Errors and Solutions",{"type":23,"tag":516,"props":1294,"children":1295},{},[1296,1317],{"type":23,"tag":520,"props":1297,"children":1298},{},[1299],{"type":23,"tag":524,"props":1300,"children":1301},{},[1302,1307,1312],{"type":23,"tag":528,"props":1303,"children":1304},{"align":530},[1305],{"type":28,"value":1306},"Error",{"type":23,"tag":528,"props":1308,"children":1309},{"align":530},[1310],{"type":28,"value":1311},"Cause",{"type":23,"tag":528,"props":1313,"children":1314},{"align":530},[1315],{"type":28,"value":1316},"Fix",{"type":23,"tag":540,"props":1318,"children":1319},{},[1320,1342,1364,1388],{"type":23,"tag":524,"props":1321,"children":1322},{},[1323,1332,1337],{"type":23,"tag":547,"props":1324,"children":1325},{"align":530},[1326],{"type":23,"tag":34,"props":1327,"children":1329},{"className":1328},[],[1330],{"type":28,"value":1331},"#REF! You don't have access",{"type":23,"tag":547,"props":1333,"children":1334},{"align":530},[1335],{"type":28,"value":1336},"Access not yet granted or revoked",{"type":23,"tag":547,"props":1338,"children":1339},{"align":530},[1340],{"type":28,"value":1341},"Open formula cell, click \"Allow access\"",{"type":23,"tag":524,"props":1343,"children":1344},{},[1345,1354,1359],{"type":23,"tag":547,"props":1346,"children":1347},{"align":530},[1348],{"type":23,"tag":34,"props":1349,"children":1351},{"className":1350},[],[1352],{"type":28,"value":1353},"#REF! The requested sheet was not found",{"type":23,"tag":547,"props":1355,"children":1356},{"align":530},[1357],{"type":28,"value":1358},"Wrong sheet name",{"type":23,"tag":547,"props":1360,"children":1361},{"align":530},[1362],{"type":28,"value":1363},"Check exact tab name in source file — case sensitive",{"type":23,"tag":524,"props":1365,"children":1366},{},[1367,1378,1383],{"type":23,"tag":547,"props":1368,"children":1369},{"align":530},[1370,1376],{"type":23,"tag":34,"props":1371,"children":1373},{"className":1372},[],[1374],{"type":28,"value":1375},"Loading...",{"type":28,"value":1377}," permanently stuck",{"type":23,"tag":547,"props":1379,"children":1380},{"align":530},[1381],{"type":28,"value":1382},"Source file is very large or network delay",{"type":23,"tag":547,"props":1384,"children":1385},{"align":530},[1386],{"type":28,"value":1387},"Reduce imported range; check source file permissions",{"type":23,"tag":524,"props":1389,"children":1390},{},[1391,1400,1405],{"type":23,"tag":547,"props":1392,"children":1393},{"align":530},[1394],{"type":23,"tag":34,"props":1395,"children":1397},{"className":1396},[],[1398],{"type":28,"value":1399},"#VALUE!",{"type":23,"tag":547,"props":1401,"children":1402},{"align":530},[1403],{"type":28,"value":1404},"Spreadsheet ID or URL is malformed",{"type":23,"tag":547,"props":1406,"children":1407},{"align":530},[1408],{"type":28,"value":1409},"Paste the full URL from the browser again",{"type":23,"tag":42,"props":1411,"children":1413},{"id":1412},"best-practices",[1414],{"type":28,"value":1415},"Best Practices",{"type":23,"tag":412,"props":1417,"children":1418},{},[1419,1437,1454,1464,1474],{"type":23,"tag":416,"props":1420,"children":1421},{},[1422,1427,1429,1435],{"type":23,"tag":112,"props":1423,"children":1424},{},[1425],{"type":28,"value":1426},"Grant access explicitly",{"type":28,"value":1428}," before sharing the destination file so colleagues do not see ",{"type":23,"tag":34,"props":1430,"children":1432},{"className":1431},[],[1433],{"type":28,"value":1434},"#REF!",{"type":28,"value":1436}," errors.",{"type":23,"tag":416,"props":1438,"children":1439},{},[1440,1445,1447,1453],{"type":23,"tag":112,"props":1441,"children":1442},{},[1443],{"type":28,"value":1444},"Import the minimum range",{"type":28,"value":1446}," needed — avoid importing entire empty columns like ",{"type":23,"tag":34,"props":1448,"children":1450},{"className":1449},[],[1451],{"type":28,"value":1452},"A:Z",{"type":28,"value":173},{"type":23,"tag":416,"props":1455,"children":1456},{},[1457,1462],{"type":23,"tag":112,"props":1458,"children":1459},{},[1460],{"type":28,"value":1461},"Use QUERY",{"type":28,"value":1463}," on top of IMPORTRANGE to avoid importing irrelevant rows.",{"type":23,"tag":416,"props":1465,"children":1466},{},[1467,1472],{"type":23,"tag":112,"props":1468,"children":1469},{},[1470],{"type":28,"value":1471},"Document sources",{"type":28,"value":1473}," — add a comment or helper cell noting which file the IMPORTRANGE pulls from.",{"type":23,"tag":416,"props":1475,"children":1476},{},[1477,1482],{"type":23,"tag":112,"props":1478,"children":1479},{},[1480],{"type":28,"value":1481},"Test imports on a dedicated tab",{"type":28,"value":1483}," before building reports on top of them.",{"type":23,"tag":759,"props":1485,"children":1486},{},[1487],{"type":28,"value":763},{"title":8,"searchDepth":765,"depth":765,"links":1489},[1490,1491,1492,1493,1494,1495,1496,1499,1500,1501],{"id":44,"depth":765,"text":47},{"id":853,"depth":765,"text":856},{"id":908,"depth":765,"text":911},{"id":954,"depth":765,"text":957},{"id":999,"depth":765,"text":1002},{"id":1120,"depth":765,"text":1123},{"id":1150,"depth":765,"text":1153,"children":1497},[1498],{"id":1202,"depth":1038,"text":1205},{"id":1227,"depth":765,"text":1230},{"id":1289,"depth":765,"text":1292},{"id":1412,"depth":765,"text":1415},"content:google-sheets:importrange-guide.md","google-sheets\u002Fimportrange-guide.md","google-sheets\u002Fimportrange-guide",{"_path":1506,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":1507,"description":1508,"category":11,"date":12,"readingTime":1509,"tags":1510,"body":1515,"_type":777,"_id":2373,"_source":779,"_file":2374,"_stem":2375,"_extension":782},"\u002Fgoogle-sheets\u002Fquery-function-guide","Google Sheets QUERY Function: SQL-Style Data Analysis in Your Spreadsheet","Master the QUERY function in Google Sheets. Learn the Google Visualization Query Language syntax to filter, sort, group, and aggregate spreadsheet data without leaving your cells.",9,[1511,11,1512,1513,1514],"QUERY function","data analysis","SQL","GQL",{"type":20,"children":1516,"toc":2357},[1517,1530,1534,1548,1604,1610,1623,1628,1642,1647,1661,1667,1679,1684,1698,1718,1724,1744,1758,1772,1778,1790,1804,1809,1823,1829,1834,1848,1867,1873,1878,1892,1897,1911,1917,1922,1936,1948,1962,1968,2075,2081,2094,2108,2121,2135,2146,2152,2157,2171,2209,2213,2353],{"type":23,"tag":24,"props":1518,"children":1519},{},[1520,1522,1528],{"type":28,"value":1521},"The ",{"type":23,"tag":34,"props":1523,"children":1525},{"className":1524},[],[1526],{"type":28,"value":1527},"QUERY",{"type":28,"value":1529}," function is arguably Google Sheets' most powerful built-in function. It accepts a range of data and a query string written in the Google Visualization Query Language (GQL) — a SQL dialect — and returns a dynamically filtered, sorted, or aggregated result set, all within a single formula.",{"type":23,"tag":42,"props":1531,"children":1532},{"id":44},[1533],{"type":28,"value":47},{"type":23,"tag":49,"props":1535,"children":1537},{"className":51,"code":1536,"language":53,"meta":8,"style":8},"=QUERY(data, query, [headers])\n",[1538],{"type":23,"tag":34,"props":1539,"children":1540},{"__ignoreMap":8},[1541],{"type":23,"tag":59,"props":1542,"children":1543},{"class":61,"line":62},[1544],{"type":23,"tag":59,"props":1545,"children":1546},{},[1547],{"type":28,"value":1536},{"type":23,"tag":734,"props":1549,"children":1550},{},[1551,1569,1579],{"type":23,"tag":416,"props":1552,"children":1553},{},[1554,1559,1561,1567],{"type":23,"tag":112,"props":1555,"children":1556},{},[1557],{"type":28,"value":1558},"data",{"type":28,"value":1560}," — The cell range to query (e.g., ",{"type":23,"tag":34,"props":1562,"children":1564},{"className":1563},[],[1565],{"type":28,"value":1566},"A1:F200",{"type":28,"value":1568}," or a named range).",{"type":23,"tag":416,"props":1570,"children":1571},{},[1572,1577],{"type":23,"tag":112,"props":1573,"children":1574},{},[1575],{"type":28,"value":1576},"query",{"type":28,"value":1578}," — A GQL query string enclosed in double quotes, or a cell reference to a string.",{"type":23,"tag":416,"props":1580,"children":1581},{},[1582,1587,1589,1594,1596,1602],{"type":23,"tag":112,"props":1583,"children":1584},{},[1585],{"type":28,"value":1586},"headers",{"type":28,"value":1588}," — Optional. Number of header rows in ",{"type":23,"tag":34,"props":1590,"children":1592},{"className":1591},[],[1593],{"type":28,"value":1558},{"type":28,"value":1595}," (usually ",{"type":23,"tag":34,"props":1597,"children":1599},{"className":1598},[],[1600],{"type":28,"value":1601},"1",{"type":28,"value":1603},").",{"type":23,"tag":42,"props":1605,"children":1607},{"id":1606},"your-first-query-selecting-columns",[1608],{"type":28,"value":1609},"Your First QUERY: Selecting Columns",{"type":23,"tag":24,"props":1611,"children":1612},{},[1613,1615,1621],{"type":28,"value":1614},"Think of ",{"type":23,"tag":34,"props":1616,"children":1618},{"className":1617},[],[1619],{"type":28,"value":1620},"SELECT",{"type":28,"value":1622}," as choosing which columns to return. Columns are referenced by letter (A, B, C…) matching their position in the data range.",{"type":23,"tag":24,"props":1624,"children":1625},{},[1626],{"type":28,"value":1627},"Return only the Name and Revenue columns from a dataset:",{"type":23,"tag":49,"props":1629,"children":1631},{"className":51,"code":1630,"language":53,"meta":8,"style":8},"=QUERY(A1:F200, \"SELECT A, D\", 1)\n",[1632],{"type":23,"tag":34,"props":1633,"children":1634},{"__ignoreMap":8},[1635],{"type":23,"tag":59,"props":1636,"children":1637},{"class":61,"line":62},[1638],{"type":23,"tag":59,"props":1639,"children":1640},{},[1641],{"type":28,"value":1630},{"type":23,"tag":24,"props":1643,"children":1644},{},[1645],{"type":28,"value":1646},"To return all columns in order:",{"type":23,"tag":49,"props":1648,"children":1650},{"className":51,"code":1649,"language":53,"meta":8,"style":8},"=QUERY(A1:F200, \"SELECT *\", 1)\n",[1651],{"type":23,"tag":34,"props":1652,"children":1653},{"__ignoreMap":8},[1654],{"type":23,"tag":59,"props":1655,"children":1656},{"class":61,"line":62},[1657],{"type":23,"tag":59,"props":1658,"children":1659},{},[1660],{"type":28,"value":1649},{"type":23,"tag":42,"props":1662,"children":1664},{"id":1663},"filtering-rows-with-where",[1665],{"type":28,"value":1666},"Filtering Rows with WHERE",{"type":23,"tag":24,"props":1668,"children":1669},{},[1670,1671,1677],{"type":28,"value":1521},{"type":23,"tag":34,"props":1672,"children":1674},{"className":1673},[],[1675],{"type":28,"value":1676},"WHERE",{"type":28,"value":1678}," clause filters rows, equivalent to a spreadsheet filter.",{"type":23,"tag":24,"props":1680,"children":1681},{},[1682],{"type":28,"value":1683},"Return all rows where Region is \"North\":",{"type":23,"tag":49,"props":1685,"children":1687},{"className":51,"code":1686,"language":53,"meta":8,"style":8},"=QUERY(A1:F200, \"SELECT A, B, D WHERE B = 'North'\", 1)\n",[1688],{"type":23,"tag":34,"props":1689,"children":1690},{"__ignoreMap":8},[1691],{"type":23,"tag":59,"props":1692,"children":1693},{"class":61,"line":62},[1694],{"type":23,"tag":59,"props":1695,"children":1696},{},[1697],{"type":28,"value":1686},{"type":23,"tag":139,"props":1699,"children":1700},{},[1701],{"type":23,"tag":24,"props":1702,"children":1703},{},[1704,1709,1711,1716],{"type":23,"tag":112,"props":1705,"children":1706},{},[1707],{"type":28,"value":1708},"Important:",{"type":28,"value":1710}," String values in GQL must use ",{"type":23,"tag":112,"props":1712,"children":1713},{},[1714],{"type":28,"value":1715},"single quotes",{"type":28,"value":1717},", not double quotes (which enclose the entire query string).",{"type":23,"tag":1200,"props":1719,"children":1721},{"id":1720},"combining-conditions",[1722],{"type":28,"value":1723},"Combining Conditions",{"type":23,"tag":24,"props":1725,"children":1726},{},[1727,1729,1735,1736,1742],{"type":28,"value":1728},"Use ",{"type":23,"tag":34,"props":1730,"children":1732},{"className":1731},[],[1733],{"type":28,"value":1734},"AND",{"type":28,"value":924},{"type":23,"tag":34,"props":1737,"children":1739},{"className":1738},[],[1740],{"type":28,"value":1741},"OR",{"type":28,"value":1743}," to combine multiple conditions:",{"type":23,"tag":49,"props":1745,"children":1747},{"className":51,"code":1746,"language":53,"meta":8,"style":8},"=QUERY(A1:F200, \"SELECT A, B, D WHERE B = 'North' AND D > 5000\", 1)\n",[1748],{"type":23,"tag":34,"props":1749,"children":1750},{"__ignoreMap":8},[1751],{"type":23,"tag":59,"props":1752,"children":1753},{"class":61,"line":62},[1754],{"type":23,"tag":59,"props":1755,"children":1756},{},[1757],{"type":28,"value":1746},{"type":23,"tag":49,"props":1759,"children":1761},{"className":51,"code":1760,"language":53,"meta":8,"style":8},"=QUERY(A1:F200, \"SELECT A, B, D WHERE B = 'North' OR B = 'South'\", 1)\n",[1762],{"type":23,"tag":34,"props":1763,"children":1764},{"__ignoreMap":8},[1765],{"type":23,"tag":59,"props":1766,"children":1767},{"class":61,"line":62},[1768],{"type":23,"tag":59,"props":1769,"children":1770},{},[1771],{"type":28,"value":1760},{"type":23,"tag":1200,"props":1773,"children":1775},{"id":1774},"using-cell-references-as-filter-values",[1776],{"type":28,"value":1777},"Using Cell References as Filter Values",{"type":23,"tag":24,"props":1779,"children":1780},{},[1781,1783,1789],{"type":28,"value":1782},"To make the filter dynamic, concatenate a cell value into the query string. Assume the region filter is in cell ",{"type":23,"tag":34,"props":1784,"children":1786},{"className":1785},[],[1787],{"type":28,"value":1788},"H1",{"type":28,"value":118},{"type":23,"tag":49,"props":1791,"children":1793},{"className":51,"code":1792,"language":53,"meta":8,"style":8},"=QUERY(A1:F200, \"SELECT A, B, D WHERE B = '\"&H1&\"'\", 1)\n",[1794],{"type":23,"tag":34,"props":1795,"children":1796},{"__ignoreMap":8},[1797],{"type":23,"tag":59,"props":1798,"children":1799},{"class":61,"line":62},[1800],{"type":23,"tag":59,"props":1801,"children":1802},{},[1803],{"type":28,"value":1792},{"type":23,"tag":24,"props":1805,"children":1806},{},[1807],{"type":28,"value":1808},"For numeric comparisons:",{"type":23,"tag":49,"props":1810,"children":1812},{"className":51,"code":1811,"language":53,"meta":8,"style":8},"=QUERY(A1:F200, \"SELECT A, B, D WHERE D > \"&H2, 1)\n",[1813],{"type":23,"tag":34,"props":1814,"children":1815},{"__ignoreMap":8},[1816],{"type":23,"tag":59,"props":1817,"children":1818},{"class":61,"line":62},[1819],{"type":23,"tag":59,"props":1820,"children":1821},{},[1822],{"type":28,"value":1811},{"type":23,"tag":42,"props":1824,"children":1826},{"id":1825},"sorting-with-order-by",[1827],{"type":28,"value":1828},"Sorting with ORDER BY",{"type":23,"tag":24,"props":1830,"children":1831},{},[1832],{"type":28,"value":1833},"Sort results by revenue descending, then by name ascending:",{"type":23,"tag":49,"props":1835,"children":1837},{"className":51,"code":1836,"language":53,"meta":8,"style":8},"=QUERY(A1:F200, \"SELECT A, B, D ORDER BY D DESC, A ASC\", 1)\n",[1838],{"type":23,"tag":34,"props":1839,"children":1840},{"__ignoreMap":8},[1841],{"type":23,"tag":59,"props":1842,"children":1843},{"class":61,"line":62},[1844],{"type":23,"tag":59,"props":1845,"children":1846},{},[1847],{"type":28,"value":1836},{"type":23,"tag":24,"props":1849,"children":1850},{},[1851,1857,1859,1865],{"type":23,"tag":34,"props":1852,"children":1854},{"className":1853},[],[1855],{"type":28,"value":1856},"DESC",{"type":28,"value":1858}," = descending (largest first), ",{"type":23,"tag":34,"props":1860,"children":1862},{"className":1861},[],[1863],{"type":28,"value":1864},"ASC",{"type":28,"value":1866}," = ascending (smallest first, the default).",{"type":23,"tag":42,"props":1868,"children":1870},{"id":1869},"limiting-results-with-limit-and-offset",[1871],{"type":28,"value":1872},"Limiting Results with LIMIT and OFFSET",{"type":23,"tag":24,"props":1874,"children":1875},{},[1876],{"type":28,"value":1877},"Return only the top 10 rows:",{"type":23,"tag":49,"props":1879,"children":1881},{"className":51,"code":1880,"language":53,"meta":8,"style":8},"=QUERY(A1:F200, \"SELECT A, B, D ORDER BY D DESC LIMIT 10\", 1)\n",[1882],{"type":23,"tag":34,"props":1883,"children":1884},{"__ignoreMap":8},[1885],{"type":23,"tag":59,"props":1886,"children":1887},{"class":61,"line":62},[1888],{"type":23,"tag":59,"props":1889,"children":1890},{},[1891],{"type":28,"value":1880},{"type":23,"tag":24,"props":1893,"children":1894},{},[1895],{"type":28,"value":1896},"Skip the first 5 rows and return the next 10 (useful for pagination):",{"type":23,"tag":49,"props":1898,"children":1900},{"className":51,"code":1899,"language":53,"meta":8,"style":8},"=QUERY(A1:F200, \"SELECT A, B, D LIMIT 10 OFFSET 5\", 1)\n",[1901],{"type":23,"tag":34,"props":1902,"children":1903},{"__ignoreMap":8},[1904],{"type":23,"tag":59,"props":1905,"children":1906},{"class":61,"line":62},[1907],{"type":23,"tag":59,"props":1908,"children":1909},{},[1910],{"type":28,"value":1899},{"type":23,"tag":42,"props":1912,"children":1914},{"id":1913},"aggregating-data-with-group-by",[1915],{"type":28,"value":1916},"Aggregating Data with GROUP BY",{"type":23,"tag":24,"props":1918,"children":1919},{},[1920],{"type":28,"value":1921},"Summarize total revenue per region:",{"type":23,"tag":49,"props":1923,"children":1925},{"className":51,"code":1924,"language":53,"meta":8,"style":8},"=QUERY(A1:F200, \"SELECT B, SUM(D) GROUP BY B\", 1)\n",[1926],{"type":23,"tag":34,"props":1927,"children":1928},{"__ignoreMap":8},[1929],{"type":23,"tag":59,"props":1930,"children":1931},{"class":61,"line":62},[1932],{"type":23,"tag":59,"props":1933,"children":1934},{},[1935],{"type":28,"value":1924},{"type":23,"tag":24,"props":1937,"children":1938},{},[1939,1941,1947],{"type":28,"value":1940},"Rename the aggregated column header with ",{"type":23,"tag":34,"props":1942,"children":1944},{"className":1943},[],[1945],{"type":28,"value":1946},"LABEL",{"type":28,"value":118},{"type":23,"tag":49,"props":1949,"children":1951},{"className":51,"code":1950,"language":53,"meta":8,"style":8},"=QUERY(A1:F200, \"SELECT B, SUM(D) GROUP BY B LABEL SUM(D) 'Total Revenue'\", 1)\n",[1952],{"type":23,"tag":34,"props":1953,"children":1954},{"__ignoreMap":8},[1955],{"type":23,"tag":59,"props":1956,"children":1957},{"class":61,"line":62},[1958],{"type":23,"tag":59,"props":1959,"children":1960},{},[1961],{"type":28,"value":1950},{"type":23,"tag":1200,"props":1963,"children":1965},{"id":1964},"available-aggregate-functions",[1966],{"type":28,"value":1967},"Available Aggregate Functions",{"type":23,"tag":516,"props":1969,"children":1970},{},[1971,1987],{"type":23,"tag":520,"props":1972,"children":1973},{},[1974],{"type":23,"tag":524,"props":1975,"children":1976},{},[1977,1982],{"type":23,"tag":528,"props":1978,"children":1979},{"align":530},[1980],{"type":28,"value":1981},"Function",{"type":23,"tag":528,"props":1983,"children":1984},{"align":530},[1985],{"type":28,"value":1986},"Description",{"type":23,"tag":540,"props":1988,"children":1989},{},[1990,2007,2024,2041,2058],{"type":23,"tag":524,"props":1991,"children":1992},{},[1993,2002],{"type":23,"tag":547,"props":1994,"children":1995},{"align":530},[1996],{"type":23,"tag":34,"props":1997,"children":1999},{"className":1998},[],[2000],{"type":28,"value":2001},"SUM(col)",{"type":23,"tag":547,"props":2003,"children":2004},{"align":530},[2005],{"type":28,"value":2006},"Total of numeric column",{"type":23,"tag":524,"props":2008,"children":2009},{},[2010,2019],{"type":23,"tag":547,"props":2011,"children":2012},{"align":530},[2013],{"type":23,"tag":34,"props":2014,"children":2016},{"className":2015},[],[2017],{"type":28,"value":2018},"COUNT(col)",{"type":23,"tag":547,"props":2020,"children":2021},{"align":530},[2022],{"type":28,"value":2023},"Number of non-empty cells",{"type":23,"tag":524,"props":2025,"children":2026},{},[2027,2036],{"type":23,"tag":547,"props":2028,"children":2029},{"align":530},[2030],{"type":23,"tag":34,"props":2031,"children":2033},{"className":2032},[],[2034],{"type":28,"value":2035},"AVG(col)",{"type":23,"tag":547,"props":2037,"children":2038},{"align":530},[2039],{"type":28,"value":2040},"Average value",{"type":23,"tag":524,"props":2042,"children":2043},{},[2044,2053],{"type":23,"tag":547,"props":2045,"children":2046},{"align":530},[2047],{"type":23,"tag":34,"props":2048,"children":2050},{"className":2049},[],[2051],{"type":28,"value":2052},"MAX(col)",{"type":23,"tag":547,"props":2054,"children":2055},{"align":530},[2056],{"type":28,"value":2057},"Maximum value",{"type":23,"tag":524,"props":2059,"children":2060},{},[2061,2070],{"type":23,"tag":547,"props":2062,"children":2063},{"align":530},[2064],{"type":23,"tag":34,"props":2065,"children":2067},{"className":2066},[],[2068],{"type":28,"value":2069},"MIN(col)",{"type":23,"tag":547,"props":2071,"children":2072},{"align":530},[2073],{"type":28,"value":2074},"Minimum value",{"type":23,"tag":42,"props":2076,"children":2078},{"id":2077},"filtering-with-date-columns",[2079],{"type":28,"value":2080},"Filtering with Date Columns",{"type":23,"tag":24,"props":2082,"children":2083},{},[2084,2086,2092],{"type":28,"value":2085},"Dates in GQL use the ",{"type":23,"tag":34,"props":2087,"children":2089},{"className":2088},[],[2090],{"type":28,"value":2091},"date 'YYYY-MM-DD'",{"type":28,"value":2093}," literal syntax:",{"type":23,"tag":49,"props":2095,"children":2097},{"className":51,"code":2096,"language":53,"meta":8,"style":8},"=QUERY(A1:F200, \"SELECT A, B, D WHERE C >= date '2024-01-01'\", 1)\n",[2098],{"type":23,"tag":34,"props":2099,"children":2100},{"__ignoreMap":8},[2101],{"type":23,"tag":59,"props":2102,"children":2103},{"class":61,"line":62},[2104],{"type":23,"tag":59,"props":2105,"children":2106},{},[2107],{"type":28,"value":2096},{"type":23,"tag":24,"props":2109,"children":2110},{},[2111,2113,2119],{"type":28,"value":2112},"To use a dynamic date from cell ",{"type":23,"tag":34,"props":2114,"children":2116},{"className":2115},[],[2117],{"type":28,"value":2118},"J1",{"type":28,"value":2120}," (which contains a date value):",{"type":23,"tag":49,"props":2122,"children":2124},{"className":51,"code":2123,"language":53,"meta":8,"style":8},"=QUERY(A1:F200, \"SELECT A, B, D WHERE C >= date '\"&TEXT(J1,\"yyyy-mm-dd\")&\"'\", 1)\n",[2125],{"type":23,"tag":34,"props":2126,"children":2127},{"__ignoreMap":8},[2128],{"type":23,"tag":59,"props":2129,"children":2130},{"class":61,"line":62},[2131],{"type":23,"tag":59,"props":2132,"children":2133},{},[2134],{"type":28,"value":2123},{"type":23,"tag":24,"props":2136,"children":2137},{},[2138,2139,2144],{"type":28,"value":1521},{"type":23,"tag":34,"props":2140,"children":2142},{"className":2141},[],[2143],{"type":28,"value":680},{"type":28,"value":2145}," function formats the date serial number into the string format GQL requires.",{"type":23,"tag":42,"props":2147,"children":2149},{"id":2148},"query-across-multiple-sheets-with-importrange",[2150],{"type":28,"value":2151},"QUERY Across Multiple Sheets with IMPORTRANGE",{"type":23,"tag":24,"props":2153,"children":2154},{},[2155],{"type":28,"value":2156},"Combine QUERY with IMPORTRANGE to query data from another Google Sheets file:",{"type":23,"tag":49,"props":2158,"children":2160},{"className":51,"code":2159,"language":53,"meta":8,"style":8},"=QUERY(IMPORTRANGE(\"spreadsheet_url\",\"Sheet1!A1:F200\"), \"SELECT Col1, Col4 WHERE Col2 = 'North'\", 1)\n",[2161],{"type":23,"tag":34,"props":2162,"children":2163},{"__ignoreMap":8},[2164],{"type":23,"tag":59,"props":2165,"children":2166},{"class":61,"line":62},[2167],{"type":23,"tag":59,"props":2168,"children":2169},{},[2170],{"type":28,"value":2159},{"type":23,"tag":139,"props":2172,"children":2173},{},[2174],{"type":23,"tag":24,"props":2175,"children":2176},{},[2177,2181,2183,2188,2189,2194,2196,2201,2202,2207],{"type":23,"tag":112,"props":2178,"children":2179},{},[2180],{"type":28,"value":365},{"type":28,"value":2182}," When using IMPORTRANGE as the data source, use ",{"type":23,"tag":34,"props":2184,"children":2186},{"className":2185},[],[2187],{"type":28,"value":1080},{"type":28,"value":557},{"type":23,"tag":34,"props":2190,"children":2192},{"className":2191},[],[2193],{"type":28,"value":1087},{"type":28,"value":2195},"... notation instead of ",{"type":23,"tag":34,"props":2197,"children":2199},{"className":2198},[],[2200],{"type":28,"value":1102},{"type":28,"value":557},{"type":23,"tag":34,"props":2203,"children":2205},{"className":2204},[],[2206],{"type":28,"value":1109},{"type":28,"value":2208},"... since the columns are renumbered.",{"type":23,"tag":42,"props":2210,"children":2211},{"id":1289},[2212],{"type":28,"value":1292},{"type":23,"tag":516,"props":2214,"children":2215},{},[2216,2234],{"type":23,"tag":520,"props":2217,"children":2218},{},[2219],{"type":23,"tag":524,"props":2220,"children":2221},{},[2222,2226,2230],{"type":23,"tag":528,"props":2223,"children":2224},{"align":530},[2225],{"type":28,"value":1306},{"type":23,"tag":528,"props":2227,"children":2228},{"align":530},[2229],{"type":28,"value":1311},{"type":23,"tag":528,"props":2231,"children":2232},{"align":530},[2233],{"type":28,"value":1316},{"type":23,"tag":540,"props":2235,"children":2236},{},[2237,2267,2288,2310],{"type":23,"tag":524,"props":2238,"children":2239},{},[2240,2249,2254],{"type":23,"tag":547,"props":2241,"children":2242},{"align":530},[2243],{"type":23,"tag":34,"props":2244,"children":2246},{"className":2245},[],[2247],{"type":28,"value":2248},"#N\u002FA",{"type":23,"tag":547,"props":2250,"children":2251},{"align":530},[2252],{"type":28,"value":2253},"No rows match the WHERE clause",{"type":23,"tag":547,"props":2255,"children":2256},{"align":530},[2257,2259,2265],{"type":28,"value":2258},"Add ",{"type":23,"tag":34,"props":2260,"children":2262},{"className":2261},[],[2263],{"type":28,"value":2264},"IFERROR()",{"type":28,"value":2266}," or check condition syntax",{"type":23,"tag":524,"props":2268,"children":2269},{},[2270,2278,2283],{"type":23,"tag":547,"props":2271,"children":2272},{"align":530},[2273],{"type":23,"tag":34,"props":2274,"children":2276},{"className":2275},[],[2277],{"type":28,"value":1399},{"type":23,"tag":547,"props":2279,"children":2280},{"align":530},[2281],{"type":28,"value":2282},"Wrong data type in WHERE",{"type":23,"tag":547,"props":2284,"children":2285},{"align":530},[2286],{"type":28,"value":2287},"Ensure string values use single quotes",{"type":23,"tag":524,"props":2289,"children":2290},{},[2291,2300,2305],{"type":23,"tag":547,"props":2292,"children":2293},{"align":530},[2294],{"type":23,"tag":34,"props":2295,"children":2297},{"className":2296},[],[2298],{"type":28,"value":2299},"Unable to parse query string",{"type":23,"tag":547,"props":2301,"children":2302},{"align":530},[2303],{"type":28,"value":2304},"Syntax error in GQL",{"type":23,"tag":547,"props":2306,"children":2307},{"align":530},[2308],{"type":28,"value":2309},"Check for mismatched quotes or unsupported keywords",{"type":23,"tag":524,"props":2311,"children":2312},{},[2313,2318,2336],{"type":23,"tag":547,"props":2314,"children":2315},{"align":530},[2316],{"type":28,"value":2317},"Headers repeating in results",{"type":23,"tag":547,"props":2319,"children":2320},{"align":530},[2321,2326,2328,2334],{"type":23,"tag":34,"props":2322,"children":2324},{"className":2323},[],[2325],{"type":28,"value":1586},{"type":28,"value":2327}," argument set to ",{"type":23,"tag":34,"props":2329,"children":2331},{"className":2330},[],[2332],{"type":28,"value":2333},"0",{"type":28,"value":2335}," with header row present",{"type":23,"tag":547,"props":2337,"children":2338},{"align":530},[2339,2341,2346,2348],{"type":28,"value":2340},"Set ",{"type":23,"tag":34,"props":2342,"children":2344},{"className":2343},[],[2345],{"type":28,"value":1586},{"type":28,"value":2347}," to ",{"type":23,"tag":34,"props":2349,"children":2351},{"className":2350},[],[2352],{"type":28,"value":1601},{"type":23,"tag":759,"props":2354,"children":2355},{},[2356],{"type":28,"value":763},{"title":8,"searchDepth":765,"depth":765,"links":2358},[2359,2360,2361,2365,2366,2367,2370,2371,2372],{"id":44,"depth":765,"text":47},{"id":1606,"depth":765,"text":1609},{"id":1663,"depth":765,"text":1666,"children":2362},[2363,2364],{"id":1720,"depth":1038,"text":1723},{"id":1774,"depth":1038,"text":1777},{"id":1825,"depth":765,"text":1828},{"id":1869,"depth":765,"text":1872},{"id":1913,"depth":765,"text":1916,"children":2368},[2369],{"id":1964,"depth":1038,"text":1967},{"id":2077,"depth":765,"text":2080},{"id":2148,"depth":765,"text":2151},{"id":1289,"depth":765,"text":1292},"content:google-sheets:query-function-guide.md","google-sheets\u002Fquery-function-guide.md","google-sheets\u002Fquery-function-guide",1792854429855]