How can I do this programmatically in Google Sheets?

How can I copy cell values rather than references from one sheet to another in Google Sheets

I have a RSS feed, that I am working along side, so I don't want to copy the reference to the other cell, rather the cell data, programatically.


You'll want to use Range.getValues().

The following function takes a range A2:B4, and returns its pure values:

function getRangeValues() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var range = sheet.getRange("A2:B4");
  var values = range.getValues();
  return values;

To use the script, you must first install it: In your spreadsheet, click Tools -> Script editor, and paste the script. From the drop-down menu in the Script Editor Toolbar, select getRangeValues, and click the Run button (you only need to do this once).
This will give you an authorization dialog, in which you must accept. From now on, you can use the function by entering =getRangeValues() in a cell.

See the example spreadsheet I have set up, and copy it to your own drive if you want to experiment with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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