Trouble With Spreadsheet

Describe the problem/error/question

I got everything working so far, there are a couple of things I would like to fix about this. First, I would love to add the email of who sent me the email to the end of the document name uploaded to Google Drive. Also with the Google Sheets, I want it to populate one line per email and attachment that is processed. Unfortunately when the information gets to the end, if I only have one google sheets at the end, it doesn’t carry the information for the emails and subject, and if it is before, I cannot add the Google Drive link. The two currently collect all the data, but the email from and to and subject go in one row, then the file name and drive link go in a new row underneath. It is also only gathering the most recent email. I want it to gather the most recent emailS that have not been added to the sheet yet. And if there is no attachment, do not add to sheet.

Please share your workflow

  • n8n version:1.44.2
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):npm
  • Operating system:Windows 10 64-bit

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @piddle99
I have a question related to your use case:

  • how do you want to handle the case when you have an email with multiple attachments? What to you want to add in that case to Google Sheets?

Here’s a modification to your workflow:

Notes:

  • I use the limit node just to limit to 1 attachment
  • To add the email to the file name I used an expression like: {{ $json.fileName.split(".")[0] + "-" + $('Gmail Trigger').item.json.from.value[0].address + "." + $json.fileName.split(".")[1]}}. This is a bit of javascript and work well only if there’s only one full stop (.) in the original name of the file. You need to modify the javascript a bit if more than one full stop is expected.
  • I then added a single Google Sheets node, but this might change depending how you want to handle the case with multiple attachments

Hope this helps

I do want it, if I have an email with multiple attachments, to make multiple rows in the google sheets with the different attachments.

@piddle99 in that case the workflow I shared should be ok, just remove the Limit node

Let me know if that works!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.