1

How do I auto-create multiple spreadsheets from a list of names contained in separate rows in a 'master/template' spreadsheet (up to 50 names, if possible)?

I think I am looking for a script/code/function/app that creates a new spreadsheet for each name listed in several rows in an existing spreadsheet. I found a function(?) that creates a new spreadsheet, but it doesn't do exactly what I want: https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet-app#create(String,Integer,Integer)

closed as too broad by Rubén, serenesat, jonsca Aug 7 '18 at 22:43

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • The question is too broad. Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Also include a brief description of your search and research efforts as is suggested on How to Ask. – Rubén Aug 5 '18 at 15:15
  • Thanks for your response. How about starting with #1 in my initial question: I would like to auto-create multiple spreadsheets from a list of names in separate rows in a 'master/template' spreadsheet (up to 50 names, if possible). Thanks. – AwR Aug 5 '18 at 16:17
  • It's fine to start with #1.Please edit your question accordingly. – Rubén Aug 5 '18 at 16:19
  • Thanks for your response. Which aspect/s of the question should be edited to make it appropriate for this instance? Thanks – AwR Aug 5 '18 at 16:25
  • See How to Ask and How do I write a great question? – Rubén Aug 5 '18 at 16:28
1

1:

function onOpen() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var menuEntries = [{name: "Add Student one by one", functionName: "addSheet"},
  ];
  ss.addMenu("master/instructor", menuEntries);
}

function addSheet() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sh = ss.getActiveSheet();
  var row = sh.getActiveRange().getRowIndex();
  var rData = sh.getRange(row, 1, 1, 3).getValues();

  if (row == 1) {
    ss.toast("This is the header");    
    return
  }

  if(rData[0][0] != null || rData[0][1] != null || rData[0][2] != null) {
    try {      
      ss.insertSheet(rData[0][2]);
      ss.setActiveSheet(ss.getSheets()[0]);
      sh.getRange("D"+(row)).setValue(new Date());
    } catch(e) {
      throw 'This student allready has a sheet. Try another sheet name.';      
    }
  }
}

2, 3, 4:

see: https://stackoverflow.com/questions/4509336/
and: https://productforums.google.com/gq2W7iLXnK8/

5:

maintaining formatting & design on a go (after the creation of slave sheets) from master/instructor sheet could lead to a lot of unwanted issues and a lot of smart scripting. its easier to set the layout at the beginning and then just replicate it on the creation

  • Sorry for my inexperience, and thanks for your assistance! I copied the script from '1' above as is into the script editor and ran but nothing happened that I am aware of - receive the error message: "This student allready has a sheet. Try another sheet name. (line 25, file "Code")". The 'master' spreadsheet has a header row with two columns, 'Name' and 'Email' and 14 rows (Name 1, Email 1; Name 2, Email 2 etc). Am I supposed to alter any of the text of the 'function onOpen()' script you provided to match the data in the 'master' spreadsheet? – AwR Aug 5 '18 at 14:49
  • Regarding 1, I think that one of the problems with that part of the answer is that it creates sheets not spreadsheets. Another problem is that there isn't any description of what the code does and how it works, and more important how it answers the question. – Rubén Aug 5 '18 at 22:02
0

What you found (link) is the reference documentation of a specific method but it's not enough.

If you are intending to use scripts you should know or be ready to learn the basics of programming and JavaScript.

One of the basics skills required is "data handling", in other words, to be able to programmatically use literals and variables to handle values and objects in JavaScript.

Regarding taking data from a Google Sheets spreadsheet the required skills are reading and writing values from/to the spreadsheet. This is explained on https://developers.google.com/apps-script/guides/sheets.

Please note that the term spreadsheet refers to the file which is able to have one or more sheets.

  • Thank you. I will study this information. In the meantime, will you read the initial answer from User0 and my subsequent response to see if User0's method may work and why I didn't see any results? – AwR Aug 5 '18 at 21:58
  • @AwR That it's not the way that this site works. If there is a follow up question derived from an answer, it should be posted as a new question. – Rubén Aug 5 '18 at 22:00

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