Returns a date as a string in YYYY-MM-DD format.
Given a date from a spreadsheet cell, returns the date in international date format (aka unix format). Used for APIs that require dates in unix format.
Extracts the domain from one or many URLs
Returns the first day of the week. Useful for formatting headers.
Converts a hash to a query parameter
Returns true if obj is an array.
Returns true if the array is actually in columns
Determines if some date is in the future.
Convert an array into a JSON string
Converts an object to a JSON string
Returns the percentage difference between two numbers.
Returns a comma separated string from a range of cells. Each one will be encoded so it can safely be used in a URL.
Returns a ratio of two numbers and rounds it up to decimal places as a percentage.
Removes HTTP or HTTPS from the beginning of one or more URLs
Converts one string into an array if it's a string
=dateToYMD(d)
| Name | Type | Description |
|---|---|---|
d |
date | Date from the spreadsheet |
| Column | Description |
|---|---|
String of the date in YYYY-MM-DD format |
Cells: A1: 11/01/2011 =dateToYMD(A1) // Returns 2011-11-01
=getDomainName(urlRange)
| Name | Type | Description |
|---|---|---|
urlRange |
string | URL |
| Column | Description |
|---|---|
Domain name as a string. |
// Returns "domain.com"
=getDomainName("http://www.domain.com/blog")
=getDomainName(A1:A10)
=getMonday(d)
| Name | Type | Description |
|---|---|---|
d |
date | Any date you want to find the start of the week for |
| Column | Description |
|---|---|
Date that is Monday (the start of the week) |
Cells: A1: 11/18/2011 =getMonday(A1) // Nov 18th is a Friday. This will return 11/14/2011 which is Monday.
=hashToParam(hashes)
| Name | Type | Description |
|---|---|---|
hashes |
hash | Hash |
var queryString = hashToParam({
"key" : "1234abcd5678",
"param" : "value",
"param2" : "value2"
}); // => "key=1234abcd5678¶m=value¶m2=value2"
=isArray(obj)
| Name | Type | Description |
|---|---|---|
obj |
obj | Some object |
| Column | Description |
|---|---|
Returns true if the object is an array |
isArray([1, 2, 3]); // => true
isArray("hello world"); // => false
=isColumn()
// myArray is A1:A3 isColumn(myArray); // => true // myArray is A1:C1 isColumn(myArray); // => false // myArray is A1 isColumn(myArray); // => false
=isInFuture(date)
| Name | Type | Description |
|---|---|---|
date |
date | The starting date |
| Column | Description |
|---|---|
True if the date is in the future, false if it's not. |
A1: 11/01/2020 =isInFuture(A1) // true
=jsonifyCol(inArray)
| Name | Type | Description |
|---|---|---|
inArray |
array | Range of cells |
| Column | Description |
|---|---|
JSON string of the first column in an array |
var myArray = [[1, 2], [3, 4]];
jsonifyCol(myArray); // => '[1, 3]'
jsonifyCol("string"); // => '["string"]';
=jsonStringify(obj)
Credit: https://gist.github.com/754454
| Name | Type | Description |
|---|---|---|
obj |
object | Object you want to make in to a JSON string |
| Column | Description |
|---|---|
JSON string |
=parseUrl(URL)
Separates a URL into seperate pieces (such as the domain name, the path, or the query string)
http://www.ora.com:80/goodparts?q#fragmenthttp//www.ora.com80goodpartsqfragment
| Name | Type | Description |
|---|---|---|
URL |
string | Url to parse |
=parseUrl("http://www.ora.com:80/goodparts?q#fragment");
=percentDiff(oldNumber, newNumber)
| Name | Type | Description |
|---|---|---|
oldNumber |
number | Old number |
newNumber |
number | New number |
| Column | Description |
|---|---|
Percentage difference from the old number to the new one. |
// // A1: Yesterday's Visits // A2: 100 // B1: Today's Visits // B2: 200 // C1: Percentage difference: // C2: =percentDiff(A2, B2) // 100%
// A1: Yesterday's Visits // A2: 100 // B1: Today's Visits // B2: 75 // C1: Percentage difference: // C2: =percentDiff(A2, B2) // -25%
=rangeToUrlString(range)
| Name | Type | Description |
|---|---|---|
range |
string | A range of cells |
| Column | Description |
|---|---|
Query string |
Cells: A1: domain.com A2: domain.com/blog =rangeToUrlString(A1:A2) // => "domain.com,domain.com%2Fblog"
=ratioUp(numerator, denominator, decimalPlaces)
| Name | Type | Description |
|---|---|---|
numerator |
number | Numerator |
denominator |
number | Denominator |
decimalPlaces |
integer | Number of decimal places |
=ratioUp(8, 43, 2) // Returns 0.19
=stripUrlScheme(url)
| Name | Type | Description |
|---|---|---|
url |
string | URL |
| Column | Description |
|---|---|
URL string without the protocol |
A1: http://www.domain.com A2: https://www.anotherdomain.com B1: =stripUrlScheme(A1:A2)
=strToArray(obj)
| Name | Type | Description |
|---|---|---|
obj |
obj | Object to convert to array |
| Column | Description |
|---|---|
Array |
strToArray("hello world"); // => ["hello world"]
strToArray(["an array"]); // => ["an array"]