Thep Excel

extractUrlPath – ฟังก์ชันดึง Path จาก URL

extractUrlPath ดึง path segment จาก URL โดยแยกออกจากโดเมน ฟังก์ชันนี้มีประโยชน์ในการวิเคราะห์ URL หรือสกัดเส้นทางสำหรับการประมวลผล

=extractUrlPath(url)

By ThepExcel AI Agent
16 December 2025

Function Metrics


Popularity
5/10

Difficulty
3/10

Usefulness
5/10

Syntax & Arguments

=extractUrlPath(url)

Argument Type Required Default Description
url string Yes URL ที่ต้องการดึก path

How it works

วิเคราะห์ Navigation

ดึก path จากผู้เยี่ยมชมเพื่อวิเคราะห์ว่าคนไปที่หน้าใด

สกัด Endpoints

ดึก path จาก API URLs เพื่อแยก endpoint

Examples

ตัวอย่างที่ 1: ดึก Path พื้นฐาน
{{ extractUrlPath('https://example.com/products/category/item') }}
ฟังก์ชันจะดึก path '/products/category/item' จากที่อยู่เว็บไซต์ สมบูรณ์ ทำให้เราได้เพียงส่วนของเส้นทางเท่านั้น
n8n Formula:

={{ extractUrlPath('https://example.com/products/category/item') }}

Result:

/products/category/item

ตัวอย่างที่ 2: ดึก Path จาก API
{{ extractUrlPath($json.apiUrl) }}
สูตรนี้ดึก path '/api/v1/users/123' จากที่อยู่ API ที่เก็บไว้ในข้อมูลอินพุต เพื่อแยกส่วนเส้นทางออกมาใช้งาน
n8n Formula:

={{ extractUrlPath($json.apiUrl) }}

Result:

/api/v1/users/123

ตัวอย่างที่ 3: วิเคราะห์ Navigation
{{ $json.visits.map(v => extractUrlPath(v.url)) }}
ดึก path จากทุก visited URLs เพื่อวิเคราะห์ navigation ของผู้เยี่ยมชม ให้เห็นว่าคนเข้าไปที่หน้าใดบ้าง ได้ผลในการวิเคราะห์พฤติกรรมผู้ใช้งาน
n8n Formula:

={{ $json.visits.map(v => extractUrlPath(v.url)) }}

Result:

[/home, /products, /blog, /contact]

FAQs

extractUrlPath() จะลบ query parameters หรือไม่?

ขึ้นอยู่กับการใช้งาน โดยปกติจะลบ query strings และเหลือเพียง path

extractUrlPath() จะรับ relative URLs ได้หรือ?

ได้ ฟังก์ชันจะดึก path segment ออกจากส่วนของ URL ที่ป้อน

ใช้ extractUrlPath() เมื่อไหร่ในการทำงาน?

ใช้เมื่อต้องการดึก path จาก URL เพื่อวิเคราะห์ navigation หรือ API endpoints

Resources & Related

Additional Notes

extractUrlPath เป็นฟังก์ชันที่ดึง path (เส้นทาง) จาก URL เช่นดึง ‘/page/content’ จาก ‘https://example.com/page/content’

Leave a Reply

Your email address will not be published. Required fields are marked *