1

I would like Google Sheets to insert a new column between columns A and B at the start of each new day with that day's date in cell B1. Is there a function or script that would make this possible?

0

Use this script, adjusting the sheet name and date format if necessary. It should be entered in Script Editor, found in Tools menu. After saving the script file, go to Resources > Current project's triggers, and create a trigger to run the function newColumn daily, at your preferred time.

function newColumn() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName('Sheet1');
  sheet.insertColumnAfter(1);
  sheet.getRange("B1").setValue(new Date()).setNumberFormat('M/d/yyyy');
}
  • Thank you! I added this to make the column width smaller as the default cell size was really large due to my Column 1 having lots of text. sheet.autoResizeColumn(2); – Alex Jul 3 '16 at 0:54

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.