6

Is it possible to create named ranges in Google sheets using google script? I would then want the spreadsheet to be able to use these in formulas.

1

2 Answers 2

2

You may want to check out this post:

setNamedRange() outside of the spreadsheet container?

and see if that helps you ..

Sign up to request clarification or add additional context in comments.

Comments

1

Class SpreadSheet has the method setNamedRange(name, Range) that can be used.

var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.setNamedRange("myNamedRange", SpreadsheetApp.getActiveRange());

Link to the Google Documentation: https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet?hl=en#setnamedrangename,-range

With me the pitfall was that I thought the method setNamedRange() belonged to the Class Range or Class Sheet. But turns out it belongs to the SpreadSheet Class.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.