Solved

Using JavaScript on the Google docs spreadsheet

Posted on 2013-06-24
5
309 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lazy load not working with masonry js 1 17
More SharePoint App with Angular and Bootstrap 17 47
Web forms being filled out by bots 4 31
how can i test my code? 1 34
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
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…
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…

776 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