Convert a Google Sheets range into URL key & value parameters with TABLE_TO_KV

Data GenerationCyrus Radfar
Jul 7

The TABLE_TO_KV function is a tool for building URLs our any key & value string quickly and properly.

The most common use case is for building trackable campaign links.

Function Signature

=TABLE_TO_KV(table, key_location, no_key_encode, no_value_encode)

Argument Definitions

input [range]

  • required - range of cells to transform with the keys included in the range.

key_location [number, default = 0]

The location of the key names, or headers.

  • 0 - first row
  • 1 - last row (bottom row)
  • 2 - first column
  • 3 - last column (far-right column)

no_key_encode [boolean, default = false]

  • Keys are underscore encoded and pushed to lower-case by default. Turn off this feature by setting no_key_encode to true.

no_value_encode [boolean ,default = false]

  • By default, URL encodes keys by replacing unsafe ASCII characters with a "%" followed by two hexadecimal digits. When TRUE, the values aren't transformed.

Use the Cheat

How to Add a Cheat to a Google Sheet

Click the Code Box to Copy

Cheat copied to clipboard ✂️👍
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

We've built an interactive tutorial in Google Sheets where it's easy to see how the function works. You can read the definition, edit examples, and do some practice examples to verify that you understand how to use the function.

Copy TutorialView TutorialDownload AppScript Code
Convert a table of data into properly encoded key and value strings for passing parameters on a URL or elsewhere.
Cyrus RadfarCyrus Radfar

Cyrus is the friendly full-stack founder of spread_cheats. He's a work optimization fanatic.

He's also working on other projects through V1.

Related Cheats