การผสานรวมข้อมูลภายนอก
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ข้อมูลสำคัญ (พื้นที่โฆษณา, Conversion ฯลฯ) มักอยู่นอกโดเมน Google
Ads ในทํานองเดียวกัน UI ของ Google Ads อาจไม่ใช่เครื่องมือที่สมบูรณ์แบบสําหรับการแสดงข้อมูลด้วยภาพเสมอไป สคริปต์ Google Ads ช่วยให้คุณ
ผสานรวมกับแหล่งข้อมูลภายนอกได้อย่างง่ายดาย
Google Spreadsheets
สเปรดชีต Google (อยู่ใน Google ไดรฟ์) เป็นโซลูชันสเปรดชีตบนเว็บที่มีฟีเจอร์ครบถ้วน
สคริปต์ Google Ads ช่วยให้คุณอ่าน
และเขียนลงในสเปรดชีตผ่านบริการสเปรดชีตได้
นอกจากนี้ คุณยังสร้างสเปรดชีต เติมข้อมูล จัดรูปแบบแบบอักษร
และสี และแชร์กับผู้อื่นได้โดยอัตโนมัติ ตัวอย่างวิธีใช้ตัวแปรในสคริปต์มีดังนี้
- การแสดงภาพรายงาน
- สเปรดชีตมีแผนภูมิหลายประเภท คุณสามารถตั้งค่าสเปรดชีตที่มี
แผนภูมิเพื่อแสดงข้อมูลด้วยภาพ แล้วนำเข้าแหล่งข้อมูลจากสคริปต์เพื่อ
อัปเดตแผนภูมิโดยอัตโนมัติ
- แหล่งข้อมูล
- คุณสร้างสเปรดชีตที่ป้อนข้อมูลด้วยตนเอง (หรือป้อนข้อมูลจากแหล่งที่มาอื่นๆ) ได้ จากนั้นสคริปต์จะอ่านและประมวลผลข้อมูลเพื่ออัปเดต
บัญชีของคุณได้ เช่น คุณสามารถป้อนคีย์เวิร์ดใหม่ลงในสเปรดชีต แล้วสคริปต์ที่ทำงานทุกวันจะเพิ่มคีย์เวิร์ดเหล่านั้นลงในบัญชี
- พื้นที่เก็บข้อมูลระดับกลาง
- สเปรดชีตสามารถจัดเก็บข้อมูลเกี่ยวกับสถานะการดำเนินการขณะที่ทำงานได้ เพื่อให้สามารถดำเนินการต่อจากจุดที่ค้างไว้ในการดำเนินการครั้งถัดไป
ตัวอย่างเช่น หากคุณต้องประมวลผลกลุ่มโฆษณาทั้งหมดในบัญชี แต่ใช้เวลานานกว่าขีดจำกัดเวลาในการดำเนินการ 30 นาที คุณสามารถบันทึกกลุ่มโฆษณาที่ประมวลผลแล้วได้ เมื่อสคริปต์ทำงานอีกครั้ง สคริปต์จะตรวจสอบสเปรดชีตเพื่อดูว่าควรเริ่มต้นที่ใดเพื่อไม่ให้มีการทำงานซ้ำ
Google ไดรฟ์
คุณยังใช้ประโยชน์จาก Google ไดรฟ์ได้มากขึ้นด้วย
DriveApp
ซึ่งช่วยให้สคริปต์สร้าง
ค้นหา และแก้ไขไฟล์ใดก็ได้ใน Google ไดรฟ์ ซึ่งสามารถใช้เป็นแหล่งข้อมูล
หรือที่เก็บข้อมูลชั่วคราวได้ตามที่แสดงก่อนหน้านี้
แผนภูมิ
นอกจากนี้ คุณยังใช้การแสดงข้อมูลผ่านภาพที่ดียิ่งขึ้นได้ผ่านบริการแผนภูมิ บริการสร้างแผนภูมิที่สมบูรณ์นี้ช่วยให้คุณควบคุมความต้องการด้านการแสดงข้อมูลด้วยภาพได้อย่างครอบคลุม
JDBC
คุณเชื่อมต่อกับฐานข้อมูลภายนอกที่สอดคล้องกับ JDBC ได้ เช่น ฐานข้อมูล Google Cloud SQL, MySQL, Microsoft SQL Server และ Oracle ดูวิธีการตั้งค่าได้ในคำแนะนำ
นี้
อีเมล
สคริปต์ Google Ads ช่วยให้คุณส่งอีเมลผ่านบริการอีเมลได้ คุณสามารถใช้อีเมลเพื่อ
แจ้งเตือนข้อมูลที่เกี่ยวข้องซึ่งคุณต้องการจากสคริปต์ได้ เช่น
ส่งอีเมลสรุปพร้อมลิงก์ไปยังรายงานฉบับเต็ม คุณปรับแต่ง
ข้อความอีเมลด้วย HTML ที่กำหนดเอง และยังเพิ่มรูปภาพได้ด้วย ซึ่งจะช่วยให้สคริปต์
ส่งรายงานที่ดูเป็นมืออาชีพไปยังลูกค้าได้โดยตรง คุณใช้ไฟล์แนบเพื่อส่งรายงานขนาดใหญ่ได้
การดึงข้อมูล URL
สคริปต์ Google Ads ช่วยให้คุณดึงเนื้อหาของ URL ที่กำหนดเองได้โดยใช้บริการดึงข้อมูล URL ฟีเจอร์นี้จะเปิดโอกาสให้คุณทำสิ่งต่างๆ ได้มากมาย ดังนี้
- ตั้งค่าฟีดที่ป้องกันด้วยรหัสผ่านในเว็บไซต์ซึ่งรายงานข้อมูลสินค้าคงคลัง
จากนั้นเข้าถึงผ่านสคริปต์ Google Ads เพื่อใช้การเปลี่ยนแปลงบัญชี
- ดึงข้อมูลเกี่ยวกับเหตุการณ์ภายนอกและตัดสินใจเกี่ยวกับการจัดการบัญชี
โดยอิงตามข้อมูลดังกล่าว เช่น คุณอาจดึงข้อมูลสภาพอากาศ
จาก API ที่ใช้ HTTP และปรับราคาเสนอหรือเปิดใช้โฆษณาเมื่อฝนตกใน
พื้นที่เป้าหมาย
- มี API มากมายให้ใช้งานได้ทั่วทั้งเว็บ โดยคุณจะเข้าถึงทุกอย่างที่มีอินเทอร์เฟซ HTTP ได้
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-27 UTC
[null,null,["อัปเดตล่าสุด 2025-08-27 UTC"],[[["\u003cp\u003eGoogle Ads Scripts facilitates integration with external data sources for enhanced data analysis and automation.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Sheets, Drive, and Charts services can be used for data visualization, storage, and reporting within Google Ads Scripts.\u003c/p\u003e\n"],["\u003cp\u003eExternal databases and custom web applications can be connected to Google Ads Scripts via JDBC and URL Fetching services.\u003c/p\u003e\n"],["\u003cp\u003eEmail functionality enables automated notifications and reporting based on script outputs.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Ads Scripts empowers users to programmatically control and automate Google Ads campaigns with external data and services.\u003c/p\u003e\n"]]],[],null,["# External Data Integration\n\nImportant data (inventory, conversions, etc.) often reside outside the Google\nAds domain. Likewise, the Google Ads UI may not always be the perfect\ntool for data visualization. Google Ads scripts provide an easy way to\nintegrate with external data sources.\n\nGoogle Spreadsheets\n-------------------\n\nGoogle Spreadsheets (found in [Google Drive](//drive.google.com)) are a\nfull-featured web-based spreadsheet solution. Google Ads scripts lets you read\nfrom and write to spreadsheets through the\n[Spreadsheet Service](/apps-script/reference/spreadsheet). You can also\nprogrammatically create a spreadsheet, populate it with data, format its fonts\nand colors, and share it with others. Some of the ways you can use them in your\nscripts include:\n\nReport visualization\n: Spreadsheets offer various types of charts. You can set up a spreadsheet with\n a chart to visualize your data, and then import the data source from a script to\n automatically update the chart.\n\nData source\n: You can create a spreadsheet where you manually input data (or input data\n from some other source). A script can then read and process the data to update\n your account. For example, you can enter new keywords to a spreadsheet that are\n then added to your account by a daily running script.\n\nIntermediate data store\n: A spreadsheet can store information about its execution state as it runs, so\n that it can pick up where it left off on the next execution. For example, if\n you need to process all ad groups in your account but it takes longer than the\n [30 minute execution time limit](/google-ads/scripts/docs/limits), you can\n record the ones you process as you go. When the script executes again, it can\n check the spreadsheet to figure out where to start so it doesn't duplicate any\n work.\n\nGoogle Drive\n------------\n\nYou can further leverage Google Drive with\n[`DriveApp`](/apps-script/reference/drive/drive-app) which lets scripts create,\nfind, and modify arbitrary files on Google Drive. This can be used as a data\nsource or intermediate datastore as previously shown.\n\nCharts\n------\n\nEnhanced data visualization is also available through the\n[Charts Service](/apps-script/reference/charts). This full-fledged chart\nbuilding service gives you extensive control over your data visualization\nneeds.\n\nJDBC\n----\n\nYou can connect to external JDBC-compliant databases such as Google Cloud SQL,\nMySQL, Microsoft SQL Server, and Oracle databases. See [this\nguide](/apps-script/guides/jdbc) for set-up instructions.\n\nEmail\n-----\n\nGoogle Ads scripts let you send out emails through the\n[Mail Service](/apps-script/reference/mail). Email can be used for\nnotifying yourself of any pertinent information you need from the script; for\nexample, mailing out a summary with a link to a full report. You can customize\nthe email message with custom HTML and even add images, allowing the script to\nsend professional-looking reports directly to your clients. Attachments can be\nused to send large reports.\n\nURL fetching\n------------\n\nGoogle Ads scripts let you fetch the content of an arbitrary URL using the\n[Url Fetch Service](/apps-script/reference/url-fetch). This feature opens\nup a range of opportunities:\n\n- Set up a password-protected feed on your website that reports inventory information. Then, access it through a Google Ads script in order to apply account changes.\n- Fetch information about external events and make account management decisions based on that information. For example, you could fetch weather information from an HTTP-based API and adjust bids or enable ads whenever it's raining in your target area.\n- There are a wide variety of APIs available across the web; anything that has an HTTP interface is accessible."]]