I2P Google From for PFO

The Idea of the project is to collect and organise responses for a PFO project. This project is the upgrade of the mentor program here at HKIS. Before this they have had to organise the responses to the forms by hand. There form was long and complex and had lots of data that was not necessary for the grouping of responses.

Below: These are two pictures of the forms for mentors and New families. These forms only include the data which I thought was necessary for sorting.

Screen Shot 2016-04-28 at 10.30.59 am Screen Shot 2016-04-28 at 10.30.46 am

If Statements in Google Script

If statements in google script are relatively similar to those in python in that it is a conditional statement. It is different however in that there is no need to write then to complete the conditional statement. In python you have to right a if statement and a then statement which concludes the conditional statement. In script you write the if statement and just follow it up with the action you want to take place if the condition is met.

Below: This code is a conditional statement that I practiced using to sort my data.

Screen Shot 2016-05-11 at 7.58.37 am

 

 

 

This program if run would read the variable cellD2 and if the value in that cell was 9 then it would go to sheet “G9” and set the value of cell D2 on sheet “G9” to 9. This code is quite basic, but I can get it to read a range and move the whole rows of data to other sheets. Which would organise the data receive from the form into grade levels.

How to access and read data off of spreadsheets

Today we learned how to access specific data on a specific spreadsheet. To do this you have to think of the spreadsheet in multiple layers. The first of which is the actual document which is represented by a link or ID.

Below: This Line of code is how you access through a variable the first layer of the spreadsheet.

Screen Shot 2016-05-11 at 7.40.12 amThen you have to access the specific spreadsheet on the doc.

Below: These are just examples of the number of different spreadsheets that I am using for my project.Screen Shot 2016-05-11 at 7.41.50 am

In the above picture there are 16 different spreadsheets all in one doc and I only want to access one. This is where you use .getSheetByName which allows you to select one specific sheet.

Below: This is the code that allows you to access through a variable the one spreadsheet.

Screen Shot 2016-05-11 at 7.47.48 am

 

 

 

This code uses the variable activeSheet to store the data from sheet “New” so it can be accessed later in the document. There is another variable in this code which is spreadSheet, this is where I stored the whole doc.

Below: This code accesses the specific box “D2”, inside the spreadsheet “New”.

Screen Shot 2016-05-11 at 7.53.04 am

 

 

 

This is the final layer of the document where I can access the data that is inside the specific box “D2”, then can log this data using the Logger.log function and the variable or var cellD2.

 

 

Hello World! Google Script

This is the first blog post of the I2P project, we were just introduced to google script. It is a little bit different from python in that it is not as simple that our a lot more commands and a lot less wiggle room.

Below: This is a photo of some of the most basic code that you can write on Google script.

Screen Shot 2016-05-09 at 12.43.22 pm

 

 

 

Logger.log is the Google script equivalent of print. As the log displays the output of the function. This picture does not fully represent what you can do with Logger.log. As in the photo it is logging the word “hello”, it can also log variables.

Working on matching variables in range


I
 had the code for reading a range, but that is useless if the data cannot be used. So I asked Mr. Lin for Help with writing code that allows me to harness in a sense the data that was collected in the range.

Below: This is the code that Mr. Lin showed to me that compares the data within the range.
Screen Shot 2016-05-09 at 12.27.01 pm

 

But, at this point I’m still unable to use this code to compare and sort the data in the range.

Below: These are the logged results of running my range finder with Mr. Lin’s Code.

 

Screen Shot 2016-05-09 at 12.36.09 pm

 

 

 

 

 

 

 

 

 

The logged results show a comparison of data which the program has collected but do not move any of the data around.