Export and Email Specific Range in Google Sheets in CSV,PDF or XLSX

Script for Exporting a specific Range from spreadsheet and save it in drive or email it in attachment in CSV, PDF or XLSX .
If you want to export just specific sheets in the spreadsheet just check this Tutorial .





How to use it :

In Spreadsheet Menu Click Tools and select Script Editor from spinner to go put your script, in Excel "Visual Basic" on developer mode.



1- Open Google Apps Script file or create new one : File > New > Script File and name it with whatever you want .

2- Past the script in the bottom of Article and Save the Script .


  • What necessary to change :
Line 5 : Range you want to export it.

Line 6: Sheet who has that range .


LINE 59 : Email Receiver, if you want to email a multiple emails just make comma between each email address e.g : 'pace3man@gmail.com ,spider-max@live.fr,......'  .

LINE 60 : replace Title word with whatever.

LINE 61 : The body of Email.

LINE 64 : The Attachment file name.


  • Finally
1-  After saving select the function name.

2- Button to run that script.

3- Run script !



The Script :



Comments

  1. How to just make a button that downloads the sheet as pdf to your computer?

    ReplyDelete
    Replies
    1. On workbook menu File > Download as > PDF

      Delete
  2. This is very cool and helpful . Is there a way to make it email automatically every Monday at 14:00?

    ReplyDelete
  3. What a great script!

    I wonder if I can also specify more than one range in your script?

    ReplyDelete
  4. hey! I have an issue, I am saying pdf of the file but in one page there are a lot of pages as in 4 copies of 1 invoice but the issue the when it saves the pdf it divides the invoice and make it on next page. in print there is also issue then. Please help.

    ReplyDelete

Post a Comment