Data
Convert a Gmail JSON Attachment to CSV
Find a Gmail message, read a named JSON attachment and export it to CSV.
Download workflow


Find a Gmail message, read a named JSON attachment and export it to CSV.
Setup
In Read Gmail JSON attachment, enter a Gmail search and the exact attachment filename, and bind a secret Variable containing a Gmail OAuth access token with read permission. Refresh the token when it expires. The first matching message must contain exactly one attachment with that filename. Run manually and download users_spreadsheet.csv.
Behavior
The attachment must contain a JSON object or array. Its nested keys are flattened into dot-separated CSV columns, matching the source Spreadsheet File node; the JSON document becomes one CSV row. The workflow does not change the message. Gmail data and the file can contain sensitive information; restrict execution and artifact access. Attachment and request sizes are subject to runtime limits.
In n8n
In n8n, connect Gmail, set the same search in Gmail, and set the filename in Select JSON attachment. Run manually. The source did not specify a search or attachment name and did not download the binary data, so these settings are required.
Inspiration & credits
Changes to the source
- Enable Gmail attachment download, select the intended JSON by filename, and add a manual trigger.
Adapted from JSON file to spreadsheet in Zie619/n8n-workflows. The source export does not identify a separate template author or license.
The collection’s MIT notice is pinned at a later revision. This is the collection notice at that revision; it does not establish a separate original template author’s license. Our changes are listed above; see repository licensing.
MIT License
Copyright (c) 2025 Zie619
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SheetJS xlsx 0.20.2 is included under the Apache License 2.0; copyright 2013-present SheetJS. The full license is included in the workflow module.