Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using JavaScript on the Google docs spreadsheet

Posted on 2013-06-24
5
Medium Priority
?
319 Views
Last Modified: 2013-06-25
Can someone help me with a JavaScript that will copy the values of I 20 in J 20 in the Google document, spreadsheet, and then paste the contents of the buffer and I 21 in J 21.
0
Comment
Question by:dwcronin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 39274324
You just need this :
function myFunction() {
  var mysheet = SpreadsheetApp.getActiveSpreadsheet();
  var source_range = mysheet.getRange("I20:J20");
  var target_range = mysheet.getRange("I21:J21");
  source_range.copyTo(target_range);
}

Open in new window

0
 

Author Comment

by:dwcronin
ID: 39274533
Please tell me how to put your function in my spreadsheet.  I'm new to making functions in my spreadsheet and I forget how they are created.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39274658
When you're on your spreadsheet go to : Insert -> Script
"Follow" the wizard

On the Script Editor window
Copy/Paste
Go to : Resources -> Current Trigger (no sure about the translation, I'm french)
Click on : Click to add one
Choose your function and how you want to trigger it (last one should be after an update)

You can easily found multiple video on youtube if needed :
http://www.youtube.com/results?search_query=trigger+script+google+spreadsheet&oq=trigger+script+google+spreadsheet
0
 

Author Comment

by:dwcronin
ID: 39275242
Can you just paste just the CONTENTS of the buffer?  Right now it is also copying the FORMATTING.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39275346
no
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question