?
Solved

Using JavaScript on the Google docs spreadsheet

Posted on 2013-06-24
5
Medium Priority
?
314 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
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…
Suggested Courses

764 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