Google sheets script

I have started a project where I will be adding my family and friends into spreadsheet posted on a website, tracking how many Instagram followers we gain each hour, each day, split into various sheets.

I want my website to have various sheets & charts with names & details, updated hourly, daily, weekly, monthly & yearly. So far this Google Sheet script only feeds the date & time but doesn’t replace. Does anyone know how to help?

Google Sheet script:

// the name of the sheet within your document
var sheetName = “Sheet1”;
// the name of the Instagram account you want to track
var instagramAccountName = “kingandmcgaw”;

function insertFollowerCount() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName(this.sheetName);
accountdata = getInstagramData(this.instagramAccountName);
sheet.appendRow([Utilities.formatDate(new Date(), “GMT”, “yyyy-MM-dd”), accountdata.followerCount]);

function getInstagramData(username) {
var r = new RegExp(’’ +
‘([^{]+?({.profile_pic_url.})[^}]+?)’ +
var url = “” + username
var source = UrlFetchApp.fetch(url).getContentText();
var jsonStr = source.match®[2];
var data = JSON.parse(jsonStr);
console.log(‘data’, data);
var oldVariantOfData = data[‘entry_data’][‘ProfilePage’][0];
console.log(‘oldVariantOfData’, oldVariantOfData);

return {
followerCount : oldVariantOfData.graphql.user.edge_followed_by.count,
followCount : oldVariantOfData.graphql.user.edge_follow.count,
mediaCount : oldVariantOfData.graphql.user.edge_owner_to_timeline_media.count

Firstly, welcome to the forums.

While we are primarily here to help people with their Free Code Camp progress, we are open to people on other paths, too. Some of what you are asking is pretty trivial in the Free Code Camp context, so you might find that if you’re not getting the instruction and material you need in your current studies, the FCC curriculum will really help you get started. At a modest guess I’d say investing a 4-5 hours working through the curriculum here will really pay off. You can find the curriculum at

With your current questions, we don’t have enough context to know what you already know or don’t know, so it is impossible to guide you without just telling you the answer (which we won’t do).

Happy coding :slight_smile: