Make Copy without Macro attached

442 views
Skip to first unread message

fernando....@dish.com

unread,
Jan 12, 2023, 1:13:18 PM1/12/23
to Google Apps Script Community
Hello Everyone,

I have a function that is part of a larger script which is attached to a Google Sheet. This function is set to make a copy the Sheet to a destination folder in Drive. I want only the contents in the workbook to be included in the copy. What would I need to add to the function which would exclude the macro?

function saveAsSpreadsheet() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet();
  var destFolder = DriveApp.getFolderById("FOLDER-ID");
  DriveApp.getFileById(sheet.getId()).makeCopy("Driver Schedule Test", destFolder);
} //END function saveAsSpreadsheet

Tanaike

unread,
Jan 12, 2023, 7:28:35 PM1/12/23
to Google Apps Script Community
In your situation, is this thread useful? https://stackoverflow.com/q/51790433

Fernando DosSantos

unread,
Jan 19, 2023, 11:28:36 AM1/19/23
to google-apps-sc...@googlegroups.com
Yes, this is very helpful. I opted to have the script create a new spreadsheet in a specific Drive location, then copy each sheet over to the new spreadsheet. This method does not copy over the macro. The approach you shared seems to be more straightforward. I will spend some time on it.

Thank you for the reply. It is much appreciated.

---

Fernando dos Santos


On Thu, Jan 12, 2023 at 7:28 PM Tanaike <kanshi...@gmail.com> wrote:

 This message originated outside of DISH and was sent by: google-apps-sc...@googlegroups.com



In your situation, is this thread useful? https://stackoverflow.com/q/51790433

--
You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/F5uF9SMhTcU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/3fee20f2-93c5-4996-9806-905d1b90ebe3n%40googlegroups.com.

Tanaike

unread,
Jan 19, 2023, 7:56:11 PM1/19/23
to Google Apps Script Community
Thank you for replying. I hope your issue will be resolved.
Reply all
Reply to author
Forward
0 new messages