Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Sheets Data Collection Instructions

Data Collection | IN PROGRESS

Contents
● Summary of Task
● Attempter Workflow
● Reviewer Workflow
● Examples of Good Tasks
● Collection Rules

Summary of Task
The purpose of this project is to collect data on how people use Google Sheets (“Sheets” for short), a
software tool used to create and edit spreadsheets. For each task, you will be given a link to a spreadsheet in
Sheets that has pre-populated data (this is called an “Initial State”). You will be asked to make a copy of the
sheet and then complete a series of specific commands (each command is called an “action”) to edit and
modify the initial state. To complete each task, you will need to record each action using a special built-in
Sheets feature called “Macros” and then paste the macro script into the corresponding text field in the task.

Initial State Example

action Examples
1. “Create a new column called profit that’s revenue minus cost”
2. “Add a total row that sums each column A-E”
3. “Add commas to all numbers”
4. “Make a pivot table showing sales by SKU”

Macro Example
function action1() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('E10').activate();
};

Attempter Workflow
The following instructions are only for Attempters. Reviewers should go directly to the Reviewer Instructions
below.

Create the Initial State


How to create an initial state: Video Overview

Step Example

Step 1
Click the spreadsheet link in the
Initial State section of the task.

Step 2 Video
Click File > Make a copy, and then
click the Make a copy button on the
“Copy document” popup
Complete Each Action
How to complete each action: Video Overview

In the new sheet you created, record a macro for EACH action below in the order that they are listed. The
process is as follows:

1. Start recording the macro by going to Extensions→Macros→Record Macro


2. Perform the action.
3. Click Save to stop the recording and then name the macro using the actionN format where N = the
action number on the task. For example, the macro for action 3 should be named action3.
4. After completing all of your actions, go to Extensions→Apps Script to find the saved macros that you
recorded for each action.
5. For each macro, copy the code and paste it into the field on the Remotasks interface that corresponds
to that action. Important: Make sure to only copy the code for the specific macro that corresponds to
the text field in Remotasks!

Reviewer Workflow
These instructions are only for Reviewers. Attempters should see the instructions above.

Create the Initial State


How to create an initial state: Video Overview

Step Example

Step 1
Click the spreadsheet link in the
Initial State section of the task.

Step 2 Video
Click File > Make a copy, and then
click the Make a copy button on the
“Copy document” popup

Review Each Action


Step 1: Open the Apps Script by going to Extensions→Apps Script.

Step 2: Copy the code from the action1 field in the Remotasks interface and paste it into macros.gs in the
Apps Script tab in a new row under the initial state script. Click Save, then select the function for the macro
you created in Apps Script and click Run to execute it. You will have to provide authorization for the script to
run.

Step 3: Check the spreadsheet to see if the action was successfully executed after running the macro. If so,
the action was done correctly. Record a macro that captures you successfully executing the action. From
there, you will need to fix the task by deleting the macro that was entered and pasting the correct one.

Step 4: Repeat steps 2-3 for each subsequent action in the task.

Step 5: Once all of the macros for each action are correct, approve/submit the task.

Examples of Good Tasks


Example 1
Initial State:
https://docs.google.com/spreadsheets/d/1ZHKZdfBFr_HcWpn2pk1mudasWdD9b8Yzc7xbOoOow8Y/edit?usp
=sharing

action Macro

action1 function action1() {


Freeze row 1. Right click on the "1" next to the row, var spreadsheet = SpreadsheetApp.getActive();
then go to View more row actions -> Freeze up to 1 spreadsheet.getRange('1:1').activate();
row spreadsheet.getActiveSheet().setFrozenRows(1);
};

action2 function action2() {


Resize the first 4 columns to "Fit to data" var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('A:D').activate();

spreadsheet.getActiveSheet().autoResizeColumns(1
, 4);

action3 function action3() {


Create a pivot table to show the counts of each var spreadsheet = SpreadsheetApp.getActive();
Rating by Sector. Highlight all rows and go to spreadsheet.getRange('1:21').activate();
Insert->Pivot Table, then select "New sheet". On the var sourceData = spreadsheet.getRange('1:21');
new sheet, add "Sector" as a row, add "Rating" as a
column, and add "Rating" as a value. You should see spreadsheet.insertSheet(spreadsheet.getActiveShe
a table with the counts of each Rating for each et().getIndex() + 1).activate();
Sector. Go back to Sheet1.
spreadsheet.getActiveSheet().setHiddenGridlines(tr
ue);
var pivotTable =
spreadsheet.getRange('A1').createPivotTable(source
Data);
pivotTable =
spreadsheet.getRange('A1').createPivotTable(source
Data);
var pivotGroup = pivotTable.addRowGroup(6);
pivotTable =
spreadsheet.getRange('A1').createPivotTable(source
Data);
pivotGroup = pivotTable.addRowGroup(6);
pivotGroup = pivotTable.addColumnGroup(1);
pivotTable =
spreadsheet.getRange('A1').createPivotTable(source
Data);
var pivotValue = pivotTable.addPivotValue(1,
SpreadsheetApp.PivotTableSummarizeFunction.COU
NTA);
pivotGroup = pivotTable.addRowGroup(6);
pivotGroup = pivotTable.addColumnGroup(1);

spreadsheet.setActiveSheet(spreadsheet.getSheetB
yName('Sheet1'), true);
};

action4 function action4() {


Change the alignment for row 1 to "Right" var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('1:1').activate();

spreadsheet.getActiveRangeList().setHorizontalAlig
nment('right');
};
action5 function action5() {
Delete all empty rows. var spreadsheet = SpreadsheetApp.getActive();
var sheet = spreadsheet.getActiveSheet();
sheet.getRange(1, 1, sheet.getMaxRows(),
sheet.getMaxColumns()).activate();
sheet = spreadsheet.getActiveSheet();
sheet.getRange(1, 1, sheet.getMaxRows(),
sheet.getMaxColumns()).createFilter();
spreadsheet.getRange('A1').activate();
var criteria = SpreadsheetApp.newFilterCriteria()
.setHiddenValues(['A', 'AA', 'BBB'])
.build();

spreadsheet.getActiveSheet().getFilter().setColumn
FilterCriteria(1, criteria);
spreadsheet.getRange('9:1003').activate();

spreadsheet.getActiveSheet().deleteRows(spreadsh
eet.getActiveRange().getRow(),
spreadsheet.getActiveRange().getNumRows());
spreadsheet.getRange('A1').activate();
criteria = SpreadsheetApp.newFilterCriteria()
.build();

spreadsheet.getActiveSheet().getFilter().setColumn
FilterCriteria(1, criteria);
};

Collection Rules

Rule Explanation Example

Macro Names Save each macro with a name in the action1, action2, action3, etc.
actionN format (for the appropriate value
of n).

Rename new tabs Each new tab that you add to an initial You create a pivot table showing
state needs to be renamed to something total sales by employee in a new
that describes what is on the sheet. sheet and the sheet is
automatically named “Sheet2”.
Change the name to something
like “Sales by Employee”

You might also like