Now I'm trying to use Google URL Shortener in Google Spreadsheet(app script).
However, when I run the script, it shows an error: "User Rate Limit Exceeded. Please sign up (line 16, file "Code")"
I went to Google Developers Console and changed Quota limit as 1000 requests/second/user, but it seems like the script didn't even send the request because the traffic reports for this API is 0.
The following is my script. I wanna get the analytics clicks for shortened URL in the spreadsheet.
function onOpen() {
total_clicks()
}
function total_clicks() {
var sheet = SpreadsheetApp.getActiveSheet();
var end = SpreadsheetApp.getActiveSheet().getLastRow();
for (var i = 2; i <= end; ++i)
{
var short_url = sheet.getRange(i, 2).getValue();
if (short_url !== "") {
var click_number = UrlShortener.Url.get(short_url, {
projection: 'ANALYTICS_CLICKS'
});
var clicks_month = sheet.getRange(i, 5);
clicks_month.setValue(click_number.analytics.day.shortUrlClicks);
var clicks_week = sheet.getRange(i, 6);
clicks_week.setValue(click_number.analytics.week.shortUrlClicks);
var clicks_month = sheet.getRange(i, 7);
clicks_month.setValue(click_number.analytics.month.shortUrlClicks);
var clicks_all = sheet.getRange(i, 8);
clicks_all.setValue(click_number.analytics.allTime.shortUrlClicks);
}
else {
}
}
}