Sunday, 15 April 2012

Getting value of a cell from google docs spreadsheet into javascript -



Getting value of a cell from google docs spreadsheet into javascript -

i have javascript function

function calculate() { var interestrate=4.5; ... }

i interestrate come cell in google docs spreadsheet. created google docs spreadsheet, , stored involvement rate in cell b2

i used "get link published data" feature in google docs to link cell b2. link looks this.

https://docs.google.com/spreadsheet/pub?key=....c&single=true&gid=0&range=b2&output=html

is there anyway of getting value link javascript function?

thanks

first of all, recommend "get link published data" csv, 1 field don't have parse it. if made spreadsheet, , create link "get link published data", sec link csv 1 field in case. able next js code (note i'm using jquery)

$.ajax("https://docs.google.com/spreadsheet/pub?key=0auwt3kepmdoude1izfvfymlqclcxbw85yznzstyyuhc&single=true&gid=0&range=b5&output=csv").done(function(result){ alert(result); });

regards

edit: total code

<!doctype> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"> </script> </head> <body> <script> $.ajax("https://docs.google.com/spreadsheet/pub?key=0auwt3kepmdoude1izfvfymlqclcxbw85yznzstyyuhc&single=true&gid=0&range=b5&output=csv").done(function(result){ alert(result); }); </script> </body> </html>

javascript google-spreadsheet google-docs

No comments:

Post a Comment