Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
dynamic fundraising thermometer from google docs / spreadsheet
<!doctype>
<html>
<head>
<script type="text/javascript">
var sheetPublicWebUrl = "https://docs.google.com/spreadsheets/d/e/2PACX-1vSbdn0eDQHBJuC3X8C4Lrmgwsomj5c4K-5x8ROhCkylVNeA5dtCq59wavQcgzmGt8qplXgUBHq-NZEj/pub?gid=0&single=true&range=b1&output=csv"
var req = new XMLHttpRequest();
req.open('GET', sheetPublicWebUrl, true);
req.onload = function() {
result = req.responseText;
cur = Number(result.replace(/[^0-9\.-]+/g,""))
document.getElementById("thermometer").innerHTML =
'<img src="https://www.abcfundraising.com/thermometer-generator?max=8500&cur='+cur+'&symbol=%24&color=green" />';
};
req.send(null);
</script>
</head>
<body>
<div id="thermometer"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment