{"product_id":"n8n-google-sheets-auto-assign-ticket-ids-by-department","title":"n8n Google Sheets: Auto Assign Ticket IDs by Department","description":"\u003ch3\u003eAutomatically assign sequential Google Sheets Ticket IDs by department (Sales, Support, Billing) in n8n\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow reads your Google Sheets rows and auto-assigns the next available \u003cstrong\u003eTicket Number\u003c\/strong\u003e per \u003cstrong\u003eDepartment\u003c\/strong\u003e, filling only blank values—without changing any ticket IDs you’ve already set.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cp\u003eDesigned to keep ticket tracking consistent, the workflow:\u003c\/p\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRuns manually\u003c\/strong\u003e when you execute it in n8n.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eFetches all rows\u003c\/strong\u003e from a specified Google Sheets worksheet.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGroups rows by the “Department” value\u003c\/strong\u003e (Sales, Support, Billing).\u003c\/li\u003e\n  \u003cli\u003eFor each department, \u003cstrong\u003efinds the highest existing Ticket Number\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGenerates the next sequential ticket IDs\u003c\/strong\u003e for rows where \u003cstrong\u003eTicket Number is blank\u003c\/strong\u003e, ordered by \u003cstrong\u003eDate Submitted\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eWrites the new Ticket Number values back\u003c\/strong\u003e to the matching rows in Google Sheets.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eWhen a support team logs requests into Google Sheets and you need reliable, department-based ticket numbering.\u003c\/li\u003e\n  \u003cli\u003eDuring migration or cleanup: assign missing Ticket IDs while preserving all already-issued IDs.\u003c\/li\u003e\n  \u003cli\u003eSaaS operators who track Sales, Support, and Billing separately but want a single sheet with consistent numbering.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eTrigger:\u003c\/strong\u003e Manual Trigger\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNodes \/ building blocks:\u003c\/strong\u003e Code, Sticky Note, Google Sheets\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGoogle Sheets setup:\u003c\/strong\u003e Use an \u003cstrong\u003eOAuth2\u003c\/strong\u003e credential, then select your spreadsheet and worksheet in both Google Sheets steps.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRequired columns:\u003c\/strong\u003e \u003cstrong\u003eDepartment\u003c\/strong\u003e, \u003cstrong\u003eTicket Number\u003c\/strong\u003e, and \u003cstrong\u003eDate Submitted\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eUpdate matching:\u003c\/strong\u003e Ensure the update step matches the correct row (preferably via a unique identifier column rather than Customer Name if names can repeat).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eCustomization:\u003c\/strong\u003e Update the department category ranges (Sales\/Support\/Billing) and starting numbers in the code to match your numbering scheme.\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45824201818291,"sku":"N8N-18170","price":41.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/DvuAroIi8DxUbnZgJ0e02_0mAY4UCc.png?v=1786612214","url":"https:\/\/buyflowscripts.com\/products\/n8n-google-sheets-auto-assign-ticket-ids-by-department","provider":"N8N Commerce","version":"1.0","type":"link"}