Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uw_cee_filter_tool
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cee
uw_cee_filter_tool
Commits
55e5b4fe
There was an error fetching the commit references. Please try again later.
Commit
55e5b4fe
authored
6 years ago
by
CECA Marketing Communications 6
Browse files
Options
Downloads
Patches
Plain Diff
removed test file
parent
f0953f7e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
google_sheets/Funding_Test.js
+0
-118
0 additions, 118 deletions
google_sheets/Funding_Test.js
with
0 additions
and
118 deletions
google_sheets/Funding_Test.js
deleted
100644 → 0
+
0
−
118
View file @
f0953f7e
/**
* @file
* @author Gerry Saporito
*/
/**
* @description function main links to 'Funding Opps' sheet in Google Sheets program by URL
* Selects all data in cells then loops through rows and columns of data
* If a certain tyoe of funding is selected, pass by reference attributes function
* @param {void}
* @returns {array}
* function returns arrays of rows filled with column values
*/
function
main
()
{
var
data
=
SpreadsheetApp
.
openByUrl
(
'
https://docs.google.com/spreadsheets/d/1xNZkHNP9CfiPUdFgWs5L9VtFbGDSE7duHstKuDeuhfg/edit#gid=1628694260
'
);
var
sheet
=
data
.
getSheetByName
(
'
Funding Opps
'
);
var
range
=
sheet
.
getDataRange
();
var
values
=
range
.
getValues
();
var
returnData
=
{};
for
(
var
i
=
0
;
i
<
values
.
length
;
i
++
)
{
var
fund
=
{};
if
(
values
[
i
][
2
]
===
"
Award
"
)
{
attributes
(
i
,
fund
,
values
);
returnData
[
i
]
=
fund
;
}
};
return
returnData
;
};
/** Contains switch case to append to object
* @param {int} Input curent row
* @param {int} Input current column
* @param {obj} Input product object
* @param {int} Input values from sheet 'Funding Opps'
* @description appends fundobj with required column information form 'Funding Opps' sheet
* @return {void}
*/
function
attributes
(
rows
,
fundobj
,
values
)
{
if
(
fundobj
[
"
DefaultCategory
"
]
===
undefined
)
{
fundobj
[
"
DefaultCategory
"
]
=
values
[
rows
][
2
];
}
fundobj
[
"
Name
"
]
=
{
//Case for name
"
bold
"
:
"
Funding:
"
,
"
text
"
:
values
[
rows
][
0
],
"
hidden
"
:
false
}
fundobj
[
"
Link_URL
"
]
=
{
//Case for URL
"
bold
"
:
"
Click here to learn more
"
,
"
href
"
:
values
[
rows
][
1
],
"
alttext
"
:
values
[
rows
][
1
],
"
target
"
:
"
_blank
"
,
"
hidden
"
:
false
}
fundobj
[
"
Category
"
]
=
{
//Cases to be used in filtering
"
hidden
"
:
true
,
"
Type
"
:
{
"
0
"
:
values
[
rows
][
2
]
//Case for type of funding
},
"
Location
"
:
{
"
0
"
:
values
[
rows
][
3
]
//Case for location
},
"
Deadline
"
:
{
"
0
"
:
values
[
rows
][
8
]
//Case for deadline
},
"
Co-op Specific
"
:
{
"
0
"
:
values
[
rows
][
9
]
//Case for co-op or non co-op
},
"
Student Type
"
:
{
"
0
"
:
values
[
rows
][
10
]
//Case for undergraduate, graduate, or other
},
"
Industry
"
:
{}
//Create object before runnning indLoop function
};
indLoop
(
rows
,
values
,
fundobj
);
//pass by reference from function below
fundobj
[
"
info
"
]
=
{
//Case for eligibility
"
bold
"
:
"
Who can apply:
"
,
"
text
"
:
values
[
rows
][
5
],
"
hidden
"
:
true
};
fundobj
[
"
apply
"
]
=
{
"
bold
"
:
"
How to apply:
"
,
"
text
"
:
values
[
rows
][
6
],
"
hidden
"
:
true
};
}
/**
* @description select cells in industry columns
* Splits cell values into array seperated by semi-colon
* function loops through cells in Industry column
* if index is of ; skip through, else add in an object key, value pair to fundobj object
* @param {int} input current row
* @param {int} input current value
* @return {void}
*/
function
indLoop
(
rows
,
values
,
fundobj
)
{
var
ind_col
=
values
[
rows
][
11
];
var
array_ind
=
ind_col
.
split
(
"
;
"
);
for
(
var
indval
in
array_ind
)
{
//for every value in array_ind add key:value pair
//assigns numbered key from array to industry values
fundobj
[
"
Category
"
][
"
Industry
"
][
indval
]
=
array_ind
[
indval
];
};
}
/**
* @param {*}
* @description
* Hooks into App Script getMethod() [Allows for API Call]
* @returns JSON object
*/
function
doGet
(
e
)
{
var
output
=
main
();
return
ContentService
.
createTextOutput
(
JSON
.
stringify
(
output
)).
setMimeType
(
ContentService
.
MimeType
.
JSON
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment