Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Is there a simple way to implement the Javascript string() function in the basic Google AdWords interface?

I want to pass some variables returned from a campaign management script to a spreadsheet (for comparing future values against historical values), but setValue() only works for strings.

The string() function does not appear to be available in the Adwords scripting interface.

I want to run something like this:-

  sheet.getRange("B2").setValue(string(A))

Can anyone help?

share|improve this question

2 Answers 2

It turns out that all I had was a capitalisation error.

It appears to be fine to send function values to the spreadsheet.

In this case the values are numeric, but it appears that the Google Spreadsheet API handles the flattening of int values to strings, so my code now just reads:-

   sheet.getRange("B2").setValue(A)

And I am a wally.

share|improve this answer
    
The road less travelled around here.... –  Simon Hayward Nov 19 '12 at 20:19
    
happens to best of us :-)) –  Sathya Nov 21 '12 at 5:38

Coercion in js is amazing and in this case you could simply use like this

sheet.getRange("B2").setValue(A + "")

Simply plus the empty string to your value.

And for something in the similar but reverse way you can use

+myString

Just using an unary + operator this will coerce the string to a number.

Find more about js coercion with a super sensei called Kyle Simpson

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.