Solved

Using JavaScript on the Google docs spreadsheet

Posted on 2013-06-24
5
304 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
  • 3
  • 2
5 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now