Last active
September 18, 2024 04:38
-
-
Save h4tr3d/6a2d4bbbfdc9f32e9aa14307b7243430 to your computer and use it in GitHub Desktop.
Google SpreadSheet JSON processing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on: https://stackoverflow.com/a/76915043/1828241 | |
// 1. Open Spread Sheet | |
// 2. Go Menu → Extensions → App Scripts | |
// 3. Create new script, rename it to JsonData.gs | |
// 4. Put this code, save | |
// 5. Return back to Spread Sheet, entry formula as usial: `=JsonData(A1; "field_name")` | |
// For compres JSON and nested fields script must be adjusted | |
function JsonData(jsonText, key) { | |
try { | |
var data = JSON.parse(jsonText); | |
return data[key] || ""; | |
} catch (error) { | |
return ""; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment