In your everyday sales activity, you often write and send thousands of cold emails to companies. Have you struggled with connecting your solution to your prospects' pain points? In this article, I walk through how to create and auto-send a sales email using ChatGPT-5, Google Apps Script, Google Sheets, and Gmail. Before getting started, you will need a Google and free ChatGPT account.
Step-by-Step Guide
Step 1: Generate a Sales Mail
First, generate a sales mail using ChatGPT-5.
- Visit https://chatgpt.com.
- Type this prompt template in the textbox with the placeholder "Ask anything."
[Role]: A seasonal sales professional. [Task]: Write a sales email. [Purpose]: (Describe the purpose to write an email) [Tone]: - Polite but friendly. - Succinct, readable structure. [Target]: (Describe to who you write the email) [Context]: (Mention recent news or announcements about the target) [Achievements]: (Describe your achievements related to the client) [Constraints]: - A subject line should be less than 10 words. - The subject line should be a message, question, or simply subject. - The body length is less than 150 words. - Include an opening line that talks about a recent, important moment of the recipient. - Avoid talking about yourself. - Include a personalized CTA that elicits a reaction more than "yes" or "no." - In a CTA part, clearly state what you can provide, e.g., "Would you like a free demo of ~?" - In the signature, include this template as is. --- ${yourCompleteInfo[0]} ${yourCompleteInfo[1]} ${yourCompleteInfo[2]} ${yourCompleteInfo[3]} | ${yourCompleteInfo[4]} ---
- Fill bold placeholders enclosed with "(" and ")" in the prompt.
- Click Enter.
Step 2: Check and Edit the Email Draft
After ChatGPT-5 generates an email draft. Check if the email is sendable and edit the email with ChatGPT-5 if needed. Please make sure that you don't enter personal information in your prompt.
d
Step 3: Generate a Google Apps Script for Email Auto-submission
After your email is ready, you will need to generate an email auto-submission Google Apps Script with ChatGPT-5.
- Type this prompt template in the same textbox that you entered the previous prompt.
[Task]: Fill the gaps, "(The subject of the email here.)" and "(The body of the email here.)" in the GAS code with the subject and full HTML email. [Number of recipients]: (Type the number of recipients) [Constraints]: - Your output must be a single code snippet. ```javascript (Your code here) ``` - When writing the greeting section, display the value of the variable "recipient" in a template literal to call with the recipient's name, e.g., ``` Dear ${recipient}; ``` [Code]: ``` function sendEmailsToList() { // Open the active spreadsheet and select the first sheet const spreadsheetId = "(Your spreadsheet id here.)"; const email_address_column = "Sheet1!A2:A13"; const recipient_name_column = "Sheet1!B2:B13"; const your_info_column = "Sheet1!E1:E5"; const otherVariableNames = ["Your full name", "Your job title", "Your company", "Your or your company's email address", "Your or your company's phone number"]; try { const data = Sheets.Spreadsheets.Values; const email_address_data = data.get(spreadsheetId, email_address_column).values; const recipient_name_data = data.get(spreadsheetId, recipient_name_column).values; const your_info = data.get(spreadsheetId, your_info_column).values; let completeEmailAddressData; // validated `email_address_data` let completeRecipientNameData; // validated `recipient_name_data` let yourCompleteInfo; // validated `your_info` const the_last_row_number_of_the_range_for_email_addresses = Number(email_address_column.substring(email_address_column.length - 1, email_address_column.length)); const the_last_row_number_of_the_range_for_recipients = Number(email_address_column.substring(recipient_name_column.length - 1, recipient_name_column.length)); const the_total_cells_for_the_range_of_email_addresses = the_last_row_number_of_the_range_for_email_addresses - 1; const the_total_cells_for_the_range_of_recipients = the_last_row_number_of_the_range_for_recipients - 1; if(!email_address_data || the_total_cells_for_the_range_of_email_addresses !== email_address_data.length) { // validate if there is a data for the range or is a value at the end cell of the range. throw new Error(`There are missing info between A2 to A${the_last_row_number_of_the_range_for_email_addresses} cells, or you are missing value for the range's end cell.`); } else { completeEmailAddressData = email_address_data.map((email, index) => { if(!email[0]) { // validate if there is a email address in the cell. throw new Error(`A${index + 2} is missing an email.`) } else { return email[0]; } }); } if(!recipient_name_data || the_total_cells_for_the_range_of_recipients !== recipient_name_data.length) { // validate if there is a data for the range or is a value at the end cell of the range. throw new Error(`There are missing info between B2 to B${the_last_row_number_of_the_range_for_recipients} cells, or you are missing value for the range's end cell.`); } else { completeRecipientNameData = recipient_name_data.map((recipient, index) => { if(!recipient[0]) { // validate if there is a recipient name in the cell. throw new Error(`B${index + 2} is missing a recipient's name.`); } else { return recipient[0]; } }); } if(!your_info || your_info.length !== 5) { // validate if there is a data for the range or is a value at the end cell of the range. throw new Error(`There are missing info between E1 to E5 cells, or your or your company's phone number is missing.`); } else { yourCompleteInfo = your_info.map((info, index) => { if(!info[0]) { // validate if there is a your info in the cell. throw new Error(`${otherVariableNames[index]} is missing.`); } else { return info[0]; } }); } // Loop through the emails and recipient names and send for (let i = 0; i < completeEmailAddressData.length; i++) { const email = completeEmailAddressData[i]; const recipient = completeRecipientNameData[i]; const subject = "(The subject of the email here.)"; const body = `(The body of the email here.)`; if (email && email.toString().includes('@')) { GmailApp.sendEmail(email, subject, body); } } } catch (err) { console.error(err.message); return; } } ``` - Adjust the cell ranges for the 2 columns for emails and recipients according to the numbers, starting from A2 or B2 cell.
- Replace
(Type the number of recipients)
in the prompt with the number of recipients you want to send to. - Click Enter.
- After ChatGPT-5 generates GAS code, click "Copy code" in the top right corner of the generated code block.
Source: https://chatgpt.com
Step 4: Execute the Google Apps Script
- Go to https://docs.google.com/spreadsheets/.
- Make sure that the Google Sheets page is your account's.
- Click "Blank spreadsheet."
Source: https://docs.google.com/spreadsheets
- Fill the cells as you can see below. For "name@example.com" and "name (number)," replace them with recipients' emails and names, and for "Your name," "sales director," "XYZ company," "Your or your company's email address," and "Yours or your company's phone number," replace them with yours. I recommend going through the rest of the steps with your email address and name first to test if the script works. After the test, go back to this step, and do the same with your recipients' email addresses.
- Visit https://script.google.com.
- Click "New project."
Source: https://script.google.com
- A new project will be created. Replace the existing code with the copied code.
Source: https://script.google.com
- Replace "(Your spreadsheet id here.)" in the code with the id of the spreadsheet. You can find the spreadsheet ID between the "d/" and "/edit" in the URL.
https://docs.google.com/spreadsheets/d/${id}/edit
Source: https://script.google.com - Click "Ctrl + S" if your operating system is Windows or "Command (⌘) + S" if your operating system is Mac to save the code.
- Click "Service."
Source: https://script.google.com
- A pop-up will be opened. Scroll down the list of the APIs until you can see "Google Sheets API."
Source: https://script.google.com
- Click "Google Sheets API."
Source: https://script.google.com
- Click "Add."
Source: https://script.google.com
- Click "Run."
Source: https://script.google.com
- A pop-up will be opened. Click "Review permissions."
Source: https://script.google.com
- Sign in to your account.
- Another pop-up will be opened. Click "Advanced."
Source: https://account.google.com
- Click "Go to Untitled project (unsafe)."
Source: https://account.google.com
- Put a tick in the checkbox to give permission to access Google services for your project.
Source: https://account.google.com
- Click "Continue."
Source: https://account.google.com
- The script will be executed.
Here's the example of an email sent.
Advanced Option: Schedule Email Submission
When you send an email, you want to send it at an optimal time. To schedule email submission, you can use Google Apps Script's time trigger. Here's how to do this.
- Go back to your Google Apps Script project.
- Click the button with a timer in the sidebar.
Source: https://script.google.com
- Click "Add Trigger" in the bottom right corner of the screen.
Source: https://script.google.com
- Click "Hour timer."
Source: https://script.google.com
- Choose "specific date and time."
Source: https://script.google.com
- Enter when your email will be sent in this format:
(year)-(month)-(day) (hour):(minute)
. Forhour
, if it's less than 10, append 0 before the hour, e.g.,08
.Source: https://script.google.com - Click "Save."
Source: https://script.google.com
- Email submission will be scheduled.
Source: https://script.google.com
Use Cases
Cold Outreach
One Redditor struggled with turning clients' problems into a compelling copy. To the pain point, one answerer gave a ready-to-use outline below.
- Thank
- Outline problem
- Ask
- Connect problem to solution
- You can add an optional line reiterating the value prop, but I think that's gilding the lily.
- Also don't forget your contact deets
If you have a working outline such as this when doing cold outreach, you can add an [Outline] section to write a sales email based on it. Here're the prompt parameter example and the result.
Parameter Example
[Role]: A seasonal sales professional. [Task]: Write a sales email. [Purpose]: To schedule a demo of a new HR automation platform. [Tone]: - Polite but friendly. - Succinct, readable structure. [Target]: HR manager at a mid-sized tech firm. [Context]: The company announced plans to expand its workforce by 30%. [Achievements]: Helped clients reduce onboarding time by 60%. [Outline]: 1. Outline problem 2. Ask 3. Connect problem to solution 4. You can add an optional line reiterating the value prop, but I think that's gilding the lily. 5. Also don't forget your contact deets [Constraints]: - A subject line should be less than 10 words. - The subject line should be a message, question, or simply subject. - The body length is less than 150 words. - Include an opening line that talks about a recent, important moment of the recipient. - Avoid talking about yourself. - Include a personalized CTA that elicits a reaction more than "yes" or "no." - In a CTA part, clearly state what you can provide, e.g., "Would you like a free demo of ~?" - In the signature, include this template as is. --- ${yourCompleteInfo[0]} ${yourCompleteInfo[1]} ${yourCompleteInfo[2]} ${yourCompleteInfo[3]} | ${yourCompleteInfo[4]} ---
Result
Subject: Ready to simplify your hiring expansion? Body: Hi ${recipient}, I saw your company’s announcement about expanding your workforce by 30%—congratulations on this exciting growth phase! Managing that scale of hiring can be challenging, especially when onboarding and admin tasks pile up. Would streamlining your HR process help your team focus more on hiring the right talent? Our automation platform has helped companies cut onboarding time by 60%, freeing HR teams to prioritize people over paperwork. Would you like a free demo to see how it could fit your current system and growth goals? Best regards, ${yourCompleteInfo[0]} ${yourCompleteInfo[1]} ${yourCompleteInfo[2]} ${yourCompleteInfo[3]} | ${yourCompleteInfo[4]} -----------------------------------------------
Follow-Up Email
Once you send the email, you will often send follow-up emails. If you use this prompt template and the Google Apps Script's time triggers, you can streamline both follow-up email generation and submission. This way, you can delegate them to AI and Google Apps Script. Here're the prompt template, the parameter example, and the result.
Prompt Template
[Role]: A seasonal sales professional. [Task]: Write a follow-up sales email. [Purpose]: (Describe the purpose to write an email) [Tone]: - Polite but friendly. - Succinct, readable structure. [Target]: (Describe to who you write the email) [Context]: (Mention recent news or announcements about the target) [Achievements]: (Describe your achievements related to the client) [Constraints]: - A subject line should be less than 10 words. - The subject line should be a message, question, or simply subject. - The body length is less than 150 words. - Include an opening line that talks about a recent, important moment of the recipient. - Avoid talking about yourself. - Include a personalized CTA that elicits a reaction more than "yes" or "no." - In a CTA part, clearly state what you can provide, e.g., “Would you like a free demo of ~?” - In the signature, include this template as is. --- ${yourCompleteInfo[0]} ${yourCompleteInfo[1]} ${yourCompleteInfo[2]} ${yourCompleteInfo[3]} | ${yourCompleteInfo[4]} ---
Parameter Example
[Role]: A seasonal sales professional. [Task]: Write a follow-up sales email. [Purpose]: To reconnect after sending an initial email about a product demo and encourage the recipient to schedule a session. [Tone]: - Polite but friendly. - Succinct, readable structure. [Target]: Marketing manager at an e-commerce brand who showed initial interest but hasn’t responded. [Context]: The brand recently hit a milestone of 1 million online customers. [Achievements]: Helped similar e-commerce brands boost conversion rates by 30% through product optimization tools. [Constraints]: - A subject line should be less than 10 words. - The subject line should be a message, question, or simply subject. - The body length is less than 150 words. - Include an opening line that talks about a recent, important moment of the recipient. - Avoid talking about yourself. - Include a personalized CTA that elicits a reaction more than "yes" or "no." - In a CTA part, clearly state what you can provide, e.g., “Would you like a free demo of ~?” - In the signature, include this template as is. --- [Your full name] [Your job title] [Your company name] [email@example.com](mailto:email@example.com) | +0 (000) 000-0000 ---
Result
Subject: Still curious about engaging your 1M customers? Body: Hi [Recipient’s Name], Congratulations on reaching one million online customers — that’s an incredible milestone! 🎉 I wanted to quickly follow up on my previous email about our product optimization tools. Many e-commerce teams like yours have used them to turn higher site traffic into measurable conversion growth. Would you like a short, tailored demo to see how your team could increase conversions during the holiday rush? I can adjust it to focus on your current sales campaign goals. Looking forward to hearing what timing works best for you. Best regards, ${yourCompleteInfo[0]} ${yourCompleteInfo[1]} ${yourCompleteInfo[2]} ${yourCompleteInfo[3]} | ${yourCompleteInfo[4]}
Upselling or Cross-Selling
If you upsell or cross-sell another product to your clients, you often write emails for the upselling or cross-selling based on their behaviors. If you use our prompt template, you can write those emails by including the past behaviors in the [Context] section. Here're the prompt parameter example and the result.
Parameter Example
[Role]: A seasonal sales professional. [Task]: Write a sales email. [Purpose]: To upsell an existing client with a premium version of the analytics dashboard. [Tone]: - Polite but friendly. - Succinct, readable structure. [Target]: Head of marketing analytics at a SaaS company. [Context]: The client has been actively using the standard analytics dashboard for six months and recently requested deeper insights on campaign ROI. [Achievements]: Helped similar clients upgrade to the premium dashboard, improving reporting accuracy by 40%. [Constraints]: - Subject line under 10 words. - Subject line should be a message, question, or simple subject. - Body length under 150 words. - Include an opening line about a recent, important moment for the recipient. - Avoid talking about yourself. - Include a personalized CTA that elicits a reaction more than “yes” or “no.” - CTA must clearly state what you can provide (e.g., “Would you like a free demo of ~?”). - Include this signature template as is.
Result
Hi [Recipient’s Name], I noticed your team has been actively tracking campaign ROI over the past few months — great to see the consistent growth in engagement metrics! Since you’ve been using the standard analytics dashboard for six months, you might find our premium version helpful. It offers granular ROI breakdowns, advanced segmentation, and customizable reports designed for marketing teams scaling fast. Would you like a quick demo to explore how the premium dashboard could uncover deeper insights for your next campaign? I can tailor it around your current data goals. Best regards, ${yourCompleteInfo[0]} ${yourCompleteInfo[1]} ${yourCompleteInfo[2]} ${yourCompleteInfo[3]} | ${yourCompleteInfo[4]}
In summary, this article went through how to generate and auto-send a sales email using ChatGPT-5, Google Apps Script, Google Sheets, and Gmail. If you want to generate emails for general purposes beyond sales, this article help you with this.

- https://www.reddit.com/r/sales/comments/1498mpn/i_just_suck_at_emailing/
- https://www.reddit.com/r/sales/comments/1498mpn/comment/jo445s9/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
Comments
Post a Comment