Use Google Apps Script (GAS) to update the cell where Column name and Row name matches the provided values.

The function produces the desired result on the sheet

=query(dataset, "select sum(C) where A='"&A2&"' and B='"&B1&"' label sum(C) ''")

But the sheet becomes very slow as this function has to be put in thousands of cells. Is there a more efficient function than this? I want to do the same using GAS.

The data looks something like this :

enter image description here

  • You are using QUERY the hard way. Instead use GROUP BY and PIVOT clauses in the SELECT argument. Here there are some Q/A that use them. The related tag is google-sheets-query. Any way, if you still want to use Apps Script, add a brief description of your search/research efforts as is suggested in How to Ask. – Rubén Feb 6 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.