App script to transform google sheets to excel on googledrive

18 views
Skip to first unread message

young bastion

unread,
Jan 29, 2023, 10:22:25 PM1/29/23
to Google Apps Script Community
Hi everyone, I want to transfer all my googlesheet tabs to googledrive. Currently it only transfers only 1 sheet, but i have no idea how to transfer all the sheets. This is my code that i took from youtube and changed up. I'm a newbie so I don't know which 1 is needed and what not. My eyes are going dizzy from doing these. Please help me

unction submitInvoice() {
  makePDF()
  makeHistory()
  clearInvoiceFields()
}

/* Send Spreadsheet in an email as PDF, automatically */
function makePDF() {
  
  // Get the currently active spreadsheet URL (link)
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var token = ScriptApp.getOAuthToken();
  var sheet = ss.getSheetByName("Invoice")



  //Creating an exportable URL
  var url = "https://docs.google.com/spreadsheets/d/SS_ID/export?".replace("SS_ID", ss.getId());
  var folderID = "1i5aZXe0aEAir6nk2jMTwIVwK2OHtN9gG"; // Folder id to save in a folder.
  var folder = DriveApp.getFolderById(folderID);
  var invoiceNumber = ss.getRange("'Invoice'!H16").getValue()
  var customerName = ss.getRange("'Invoice'!B16").getValue()
  var shipment = ss.getRange("'Invoice History'!J2").getValue()
  var pdfName =  "Invoice #AF"+ invoiceNumber + " " + customerName + " - " + Utilities.formatDate(new Date(), "GMT+8", "dd-MM-yyyy") + " " + shipment;




Reply all
Reply to author
Forward
0 new messages