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.
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.
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.
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.
Then 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.
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.
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”.
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.
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.
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.
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.
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.
The logged results show a comparison of data which the program has collected but do not move any of the data around.