Skip to content

Commit

Permalink
Add file for coming-soon Apps Script quickstart guide.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyDiamondstein authored Apr 25, 2017
1 parent 954f7e0 commit 875d380
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions apps-script/quickstart.gs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Note: Apps Script automatically requests authorization

This comment has been minimized.

Copy link
@shuv2866

shuv2866 May 29, 2020

// Note: Apps Script manually requests authorization

This comment has been minimized.

Copy link
@veemusica

veemusica Aug 15, 2021

hi

This comment has been minimized.

Copy link
@PrinceGamingff

This comment has been minimized.

Copy link
@toretto87-kill
// based on the API's used in the code.

function channelsListByUsername(part, params) {
var response = YouTube.Channels.list(part,

This comment has been minimized.

Copy link
@shuv2866

shuv2866 May 29, 2020

YouTube

params);
var channel = response.items[0];
var dataRow = [channel.id, channel.snippet.title, channel.statistics.viewCount];
SpreadsheetApp.getActiveSpreadsheet().appendRow(dataRow);
}

function getChannel() {
var ui = SpreadsheetApp.getUi();
var channelName = ui.prompt("Enter the channel name: ").getResponseText();
channelsListByUsername('snippet,contentDetails,statistics',
{'forUsername': channelName});
}

function getGoogleDevelopersChannel() {
channelsListByUsername('snippet,contentDetails,statistics',
{'forUsername': 'GoogleDevelopers'});
}

function onOpen() {
var firstCell = SpreadsheetApp.getActiveSheet().getRange(1, 1).getValue();
if (firstCell != 'ID') {
var headerRow = ["ID", "Title", "View count"];
SpreadsheetApp.getActiveSpreadsheet().appendRow(headerRow);
}
var ui = SpreadsheetApp.getUi();
ui.createMenu('YouTube Data')
.addItem('Add channel data', 'getChannel')
.addSeparator()
.addItem('Add GoogleDevelopers data', 'getGoogleDevelopersChannel')
.addToUi();
}

2 comments on commit 875d380

@shofian05121992
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on

@shofian05121992
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conneted

Please sign in to comment.