Skip to main content

Importing Data from Bromcom directly into a Google Sheet and updating it automatically

I support one school in the Trust that used Bromcom and was finding it a bit tricky to get the data directly into Sheets. However, I've sorted this now and thought this might prove useful to someone.

Step 1 - The Bromcom Report
Write your report (or pick an existing one). Click Run Report and then select “Live Data Feed”.
Copy the URL it gives you.

Step 2 - Your user name and password to access the report
You need the site ID which is the username. You also need your “User Access Key”. To get this click top right and “My account” and you will see a box with this in. Make a note of these.

Step 3 - Setup the Google Sheet
Make a Google Sheet that is going to receive the data.
Click on “Tools” then Script and paste in this code:

function populateSheetWithCSV(sheet, csvUrl, user, pw) {
  var resp = UrlFetchApp.fetch(csvUrl, {
    headers: {
      // use basic auth
      'Authorization': 'Basic ' + Utilities.base64Encode(
      user + ':' + pw, Utilities.Charset.UTF_8)
    }
  });
  var doc = XmlService.parse(resp);
  var students = doc.getRootElement().getAllContent();
  var spreadsheetContent = [];
  var maxLength = 0;
  for (var j=0; j<students.length-1; j++)
  {
   var length = students[j].getValue().trim().split("\n").length;
   if (maxLength < length)
   {
     maxLength = length;
   }
  }
  // Get all the data into a 2D Array
  for (var i=0; i<students.length-1; i++)
  {
    var studentDetails = students[i].getValue().trim().split("\n");
    if (studentDetails.length > 1) {
      if (studentDetails.length < maxLength)
      {
        var diff = maxLength - studentDetails.length;
        for (var k = 0; k<diff; k++)
        {
          studentDetails.unshift("");
        }
      }
      spreadsheetContent.push(studentDetails);
    } 
  }
  Logger.log(spreadsheetContent);

// clear everything in the sheet
    sheet.clearContents().clearFormats();
// set the values in the sheet (as efficiently as we know how)
    sheet.getRange(
        1, 1,
        spreadsheetContent.length /* rows */,
        maxLength /* columns */).setValues(spreadsheetContent);
}
function main() 
{
  populateSheetWithCSV(SpreadsheetApp.getActiveSheet(), 
                     "YOURREPORTURLHERE",
                     "YOURSCHOOLNUMBER",
                     "YOURACCESSKEYHERE");
}

Put in your report URL, School ID and your access key in where the red text is.

Save the script and run the function "main". Your Bromcom report will now appear in your Sheet.

You can click the timer button to make "main" run on a schedule - to update the data as often as you like.

I'd like to thank my son, Robert Nixon (3rd Year Computer Science Student) for his extensive help with the code!

Comments

  1. "I'd like to thank my son, Robert Nixon (3rd Year Computer Science Student) for his extensive help with the code!"

    If your son Robert is seeking for a position in an exciting software developments, please ask him to contact personnel@bromcom.com and refer to this article.

    ReplyDelete
  2. Happy to help!

    - Robert
    www.robertnixon.net

    ReplyDelete
  3. Hi! We currently don't have any management for our Windows machines which is something we really would like to fix. Since we use 95% Chrome OS devices and G-Suite for Education it seems it might be a good idea. However, with no software support it seems a bit limited. The only real reason for having Windows machine over a Chrome device is the software. You mentioned that you use scripts to manage the software if I understood you correctly? If so, can you please tell me a bit more on how you do that? Thanks.

    ReplyDelete
    Replies
    1. Think you meant to comment on this post: https://wpsit.blogspot.com/2020/02/google-mdm-for-windows-10-devices-more.html

      My basic script is at the bottom.

      Delete

Post a Comment

Popular posts from this blog

Delete a specific email using GAM

If a user send an inappropriate email to a loads of people or get stung by some sort of email exploit you can quickly delete the email from all of the recipients using a GAM command. Step 1 - get the email header Go into Google Vault and search for the offending user or someone known to have got the message. Click show details and grab the email ID. This will be a long string of characters followed by @mail.gmail.com Step 2 - find out who has the email Go into Google Vault and find the original message sent by the offending user. Look at the details to see who got it. Copy the list and dump it into a spreadsheet. Clean up to just a list of emails with a column header 'mail'. Save as a csv file. Step 3 - delete messages with GAM Put your CSV file in your GAM folder - this e.g. assumes its called mail.csv Run: gam csv mail.csv gam user ~mail delete messages query rfc822msgid: MESSAGEIDHERE doit The alternative nuke option is: gam all users delete messages query rf...

My favorite GAM commands - well a few of them at least!

Where would be without GAM? Paying for expensive syncing tools or doing tedious manual tasks in the admin console. GAM can automate most things you might want to do in G Suite. So these are a few of my favourite commands - one I use either as part of a batch file - or just standalone. There are loads more - but these are ones that are used daily. Classroom Create a spreadsheet of all your domains classes -  gam print courses todrive Create a spreadsheet of a teacher's classes:  gam print courses teacher fred@mydomain.com todrive Bulk create classes: gam csv classes.csv gam create course alias ~alias name ~alias section ~subject teacher ~teacher status ACTIVE where classes.csv is a list of classes you want to make. Add teachers: gam csv teachers.csv gam course ~alias add teacher ~teacher Add students: gam csv students.csv gam course ~alias add teacher ~student Sync Students (in this example to a group - but could be an ou/csv file) gam csv grou...

Google MDM for Windows 10 Devices - a more in depth look.

In my previous blog post, I gave an overview of Google's new mobile device management for Windows 10 devices. A few weeks in now, we have a number of users using Windows computers managed this way. So below is a more detailed video look at deploying policies followed by some of the policies and how to configure them that we have used to date. Policy Settings It's important to note that unlike ChromeOS devices, you don't put machines into OUs, but the machines pick up policy based on the OU of the user used to enrol the device. OMA-URI policies we use: AllowManualMDMUnenrollment ./Device/Vendor/MSFT/Policy/Config/Experience/AllowManualMDMUnenrollment Integer 0 This prevents users from unenrolling a device. AllowVPN ./Device/Vendor/MSFT/Policy/Config/Settings/AllowVPN Integer 0 Prevents editing the VPN settings PageVisibilityList ./Device/Vendor/MSFT/Policy/Config/Settings/PageVisibilityList string hide:network-vpn Can be used to hide bits of the set...