By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,963 Members | 1,815 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,963 IT Pros & Developers. It's quick & easy.

Google App Javascript Import of html

Expert 100+
P: 391
Hi.

Firstly apologies, but I'm experimenting and hope my question makes some kind of sense!

I am trying to write a script for a google spreadsheet, and would like to import some crypto code from elsewhere.

The code I would like to use is here. The home page, showing the usage is here.

I have written some code to test the principle:
Expand|Select|Wrap|Line Numbers
  1. function endecode(){
  2.  
  3.   var sheet=SpreadsheetApp.getActiveSheet();
  4.   var input=sheet.getRange(2, 1);
  5.   var password=sheet.getRange(2,2);
  6.   var encrypted=sheet.getRange(2,3);
  7.   var decrypted=sheet.getRange(2,4);
  8.  
  9.  
  10. encrypted.setValue(CryptoJS.TripleDES.encrypt(input.getValue(), password.getValue()));
  11. decrypted.setValue(CryptoJS.TripleDES.decrypt(encrypted.getValue(), password.getValue()));
  12.  
  13. };
  14.  

Obviously this doesn't work, because it doesn't recognize cryptoJS. But how can I import CryptoJS.

I know almost nothing about JavaScript - my method is just to copy and edit snippets from elsewhere, which works fine since I'm generally doing very simple things!

I even tried just copying the stuff from http://crypto-js.googlecode.com/svn/...s/tripledes.js straight into my function, but when I run it, there is a server error.
Oct 29 '12 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,430
What's the server error? You shouldn't copy it into your function. It has functions of its own and those need to be declared outside any other function.
Oct 29 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.