re: Using Sheets and the YouTube API to track video analytics VIEW POST


Rick, this works great.
Problem is: I'm toying around with the idea of having multiple sheets. I created a new one, renamed it something else, replaced that name in your YouTube Analytics scripts, but it doesn't work on this new sheet.
It seems to copy existing values from the original Sheet1.

Any way around this?

Thanks a million!


Hard to tell without looking at the whole spreadsheet. Are you able to share it with me?


Here is the sheet: docs.google.com/spreadsheets/d/1kj...

Here is the modified script, trying to get data for the first sheet (Stats For Video): script.google.com/d/1fkQ6lOM3fNnH7...


Ah, the issue is that the "IDs" named range is pointing to the old 'Video Stats' sheet.

Now I don't know what to think any more :(
I've renamed the sheet back to the original name. I've copy-pasted your script again.
I get this error: TypeError: Cannot call method "getValues" of null. at getVideoIds(Code:35) at updateStats(Code:26)

What am I doing wrong?

Go to "Data > Named ranges..." to define a range of cells. There should be one named "IDs" spanning B2:B1000. This corresponds to the VIDEO_ID_RANGE_NAME variable in the script.

Yup. Works like a charm now.
Can this be modified to track several sheets? Or would I need to create a script for each sheet?

Thanks again!

The script needs to know which video IDs to look up, so if you want to spread the IDs over multiple sheets, you can create multiple named ranges and iterate through each one. No need for multiple scripts.

Code of Conduct Report abuse