Exporting data from the PMax sheet

Script owner @SZ left a note in the members’ area wanting to know if it’s possible to extract all search category data from his pmax sheet, into a new sheet so he could build new ad groups from this data.

Not only is it possible, it’s easy - once you know a couple of Google Sheet formulae.

—

In the PMax sheet, there are two hidden sheets called: terms & totalTerms

terms has campaign info

totalTerms has the data Mattias wants, all unique search categories in the account with their respective metrics.

So here are the steps to solve the problem:

—

Create a new sheet (sheet.new). Use the same email you use for the main PMax sheet.

Use the =IMPORTRANGE formula

Enter the URL of your PMax sheet (in quotes) & the range of data you want, like this:

=IMPORTRANGE("https://docs.google.com/spreadsheets/d/1T…", "totalTerms!A:G")


You should see a #REF! error in your sheet, because you first need to give permission for the 2 sheets to talk. Hover over the error & click ‘Allow Access’


Now we have data!

Next you’ll need to recreate the AOV column (assuming like Mattais that’s the metric you want to filter on). It’s easy, don’t let the word array freak you out :)

Since AOV is = conv value / value,
In cell H1 type ‘AOV, and in cell H2 type: =ARRAYFORMULA(E2:E/D2:D)

Using arrayformula just means you don’t have to copy the formula down all the rows, it calcs everything for you in one go.

Format it however you like (eg 0, 1 or 2 decimal places). These shortcut keys help:

BTW, if your sheet is in the ‘wrong’ currency, just go to File>Settings and change the ‘Locale’ (that’s country to us non-posh folk).

—

Filtering.

Now the regular filter won’t work with array formulas

So create a new tab, and assuming the first tab was Sheet1 (change as needed below), type:

=QUERY(Sheet1!A:H, "SELECT * WHERE H>190 ORDER BY H DESC")

That’s going to get all the data (*) from the first tab

Filter it for col H (AOV) > 190 (again, change this value for whatever you need)

And Sort it by AOV from high to low (DESC)


Yeah it looks scary the first time, but it’s really not that bad once you’ve used it a couple of times

And you no longer need to remember all these formula by rote.

Next time you get stuck just ask chatGPT

“I have a bunch of data in Sheet1, columns A to H. I want to use Query to get all that data in to a new sheet, where AOV (which is in col H) is more than 190. Also sort it by AOV hugh to low”

Easy.

I hope that helps.

LMK what data YOU use this for… maybe I need to build new functionality into the PMax sheet.