I'm a newbie for both scripting and Google scripts. I basically need to create a sort of timetable on a Google Spreadsheet in which every tab is a week, always starting by Monday, in a due interval set in 2 cells.

Let's say:

  1. Cell A1 (starting date): 5 September 2018
  2. Cell A2 (finish date): 26 September 2018

I'd need a script that:

  • reads A1, understands that the 5th is a Wednesday
  • creates a first new tab named "3-7 Sept 18"
  • cycles for all weeks with the same rule (from Monday To Friday) until A2, so the fourth and last new tab created is named "24-28 Sept 18"

Any precious hints?

  • Welcome. Please add a brief description of your search/research efforts. Ref. How to Ask – Rubén Aug 28 '18 at 12:26
  • Hi @Ruben, all, I obviously searched through this site and others in order to understand but I didn't find what I needed. Anyway, I'm almost there: here follows my code. – Andrea Aug 30 '18 at 8:54
  • >function makeTabs() { > var ss = SpreadsheetApp.getActiveSpreadsheet(); > var sheet = ss.getSheetByName('Appoggio'); > var last = sheet.getLastRow(); > for(var i=1; i<last; i++){ > ss.getSheetByName('Template') //copy and rename > .copyTo(ss) > .setName(ss.getSheetByName('Appoggio') > .getRange(i+1, 7) > .getValue()) > var TabName = sheet.getName(); > Browser.msgBox("tab "+TabName+"_"+i, Browser.Buttons.OK); > } >} – Andrea Aug 30 '18 at 8:59
  • uhm, why formatting <br/> doesn't work? – Andrea Aug 30 '18 at 9:00
  • As incredible as it could sound, it isn't obvious that you made efforts to answer your question prior to posting it. Regarding providing additional relevant details about the question, edit the question to add them directly to it. – Rubén Aug 30 '18 at 13:45

Your Answer

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

Browse other questions tagged or ask your own question.