# Email CSV file to user

**URL:** <https://community.glideapps.com/t/email-csv-file-to-user/81437>\
**Category:** Ask for Help\
**Created:** [April 19, 2025, 4:59pm UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437 "2025-04-19T16:59:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [April 19, 2025, 4:59pm UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/1 "2025-04-19T16:59:00Z")

</div>

I have a workflow to generate a csv of a table. I want the user to be able to receive the CSV as a file via email (not a link to the Glide stored file, but as an attachment to the email). I tried this through a web hook using google script t but it seems that glide won’t let the script access the url of the csv. Any ideas about how to achieve this?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [April 19, 2025, 5:03pm UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/2 "2025-04-19T17:03:46Z")

</div>

> [@BLA\_68](#):
>
> I tried this through a web hook using google script t but it seems that glide won’t let the script access the url of the csv.

That doesn’t sound right. The URL should be publicly accessible.

Personally, I would probably use Make. Send a webhook with the generated URL, use a HTTP module to download it, and a Gmail module to send the email.

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [April 19, 2025, 5:10pm UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/3 "2025-04-19T17:10:39Z")

</div>

Well after living in the workflow and google script windows for an hour and watching it throw errors I went into my email and found that, in fact, it did work and it sent the file as expected so not sure why it was giving me a 302 error in workflows.

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [April 19, 2025, 5:27pm UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/4 "2025-04-19T17:27:15Z")

</div>

Hmmm. I’ll try your approach since this is not really working reliably.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [April 19, 2025, 10:44pm UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/5 "2025-04-19T22:44:08Z")

</div>

This is also the way I have been doing it whenever I need an attachment. Wish Glide can let us do this right in the app.

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [April 19, 2025, 11:22pm UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/6 "2025-04-19T23:22:56Z")

</div>

I was really hoping to use google scripts. Doing some very basic testing and deploying the script as webhook/web app, when I run the script in glide it produces a 302 error every time. Is it not possible to use a google script as a web hook this way?

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [April 20, 2025, 12:10am UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/7 "2025-04-20T00:10:56Z")

</div>

Can you show us how your script is set up?

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [April 20, 2025, 12:38am UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/8 "2025-04-20T00:38:42Z")

</div>

This was the script for testing.

```auto

function doPost(e) {
  try {
    // Parse incoming data
    var data = {};
    if (e.postData && e.postData.contents) {
      data = JSON.parse(e.postData.contents);
    }

    // Log data to a Google Sheet
    logToSheet(data);

    // Build response
    var response = {
      success: true,
      message: "Data received",
      timestamp: new Date().toISOString(),
      receivedData: data
    };

    // Return response as JSON
    return ContentService
      .createTextOutput(JSON.stringify(response))
      .setMimeType(ContentService.MimeType.JSON);

  } catch (error) {
    var errorResponse = {
      success: false,
      message: error.toString(),
      timestamp: new Date().toISOString()
    };

    return ContentService
      .createTextOutput(JSON.stringify(errorResponse))
      .setMimeType(ContentService.MimeType.JSON);
  }
}

// Helper function to log to a sheet
function logToSheet(data) {
  const sheetId = 'YOUR_GOOGLE_SHEET_ID'; // <-- put your Sheet ID here
  const sheetName = 'Webhook Log'; // <-- or change if you want another sheet name
  
  const ss = SpreadsheetApp.openById(sheetId);
  const sheet = ss.getSheetByName(sheetName) || ss.insertSheet(sheetName);

  // Set up headers if the sheet is empty
  if (sheet.getLastRow() === 0) {
    sheet.appendRow(['Timestamp', 'Raw Data']);
  }

  // Append the new data
  sheet.appendRow([
    new Date().toISOString(),
    JSON.stringify(data)
  ]);
}

```

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [April 20, 2025, 12:45am UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/9 "2025-04-20T00:45:37Z")

</div>

Please try this:

1. Go to your Apps Script project editor.

2. Click **Deploy** \> **Manage deployments**.

3. Find the active deployment you are using for the webhook.

4. Click the **Edit** button (pencil icon).

5. Change the settings to:

- **Execute as:**  **Me** (Your Google Account)

- **Who has access:**  **Anyone, even anonymous**

1. Click **Deploy**. This will likely create a new version of the deployment. You may need to authorize the script yourself again when prompted during this process, granting your account permission to run it and access Sheets on your behalf.

2. **Important:** Ensure you are using the **Web app URL** provided after this deployment in your Glide webhook action.

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [April 20, 2025, 12:47am UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/10 "2025-04-20T00:47:53Z")

</div>

Thanks. This must be the solution because I’ve seen that advice elsewhere but wondered if Glide had some particular requirements I wasn’t aware of. Somehow I’m not doing this right but I’ll follow those steps again more carefully.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [April 20, 2025, 12:50am UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/11 "2025-04-20T00:50:11Z")

</div>

It seems like you have some sort of access problem. Glide might have been blocked by a consent screen while trying to execute it.

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [April 20, 2025, 1:28am UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/12 "2025-04-20T01:28:10Z")

</div>

I agree. Is there anyway to log that so I can get a hint to what might be happening?

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [April 20, 2025, 1:36am UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/13 "2025-04-20T01:36:22Z")

</div>

I would suggest trying the method above first to see if it helps. If it doesn’t help, some console.log() might help.

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [April 20, 2025, 3:05am UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/14 "2025-04-20T03:05:59Z")

</div>

I’m truly flummoxed. Very carefully followed the approach suggested. I even tried it a second time from a personal google account in case there were some settings in my workspace google account (I could find none) that might be causing this. I tried the web app url in both the web hook and Call API workflows and same result: 302. Would love any further clues, but maybe I cut my losses and try it through Make

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [April 20, 2025, 3:14am UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/15 "2025-04-20T03:14:40Z")

</div>

What if you open the URL in a new window in your browser. What happens?

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [April 20, 2025, 5:21am UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/16 "2025-04-20T05:21:51Z")

</div>

I get an error: Script function not found: doGet

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [April 20, 2025, 1:38pm UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/17 "2025-04-20T13:38:27Z")

</div>

Does the URL you’re using end in /exec?

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [April 20, 2025, 2:14pm UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/18 "2025-04-20T14:14:06Z")

</div>

Yes, it does. [https://script.google.com/macros/s/xxxx/exec](https://script.google.com/macros/s/xxxx/exec)

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [April 20, 2025, 11:50pm UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/19 "2025-04-20T23:50:56Z")

</div>

![CleanShot 2025-04-21 at 06.50.25](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/d/1d500556e41cb91ef6fbd3c7ea896093e544932a.png)

Seems like this might be the case.

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [April 22, 2025, 9:18pm UTC](https://community.glideapps.com/t/email-csv-file-to-user/81437/20 "2025-04-22T21:18:24Z")

</div>

Argh. Ok. Well looking to Make next.

[Next page](https://community.glideapps.com/t/email-csv-file-to-user/81437.md?page=2)
