Kodlama seviyesi:
başlangıç düzeyi
Süre: 5 dakika
Proje türü: Özel işlev
Hedefler
- Çözümün ne işe yaradığını anlayın.
- Apps Komut Dosyası hizmetlerinin çözümüne geçelim.
- Komut dosyasını ayarlayın.
- Komut dosyasını çalıştırın.
Bu çözüm hakkında
Bir e-tablodaki birden fazla sayfada benzer şekilde yapılandırılmış verileriniz varsa ekip üyelerine yönelik müşteri desteği metrikleri olarak, bu özel işlevi kullanarak her sayfanın bir özetini oluşturabilirsiniz. Bu çözüm müşteri desteğine odaklanır ihtiyacınıza göre özelleştirebilirsiniz.
İşleyiş şekli
getSheetsData()
adlı özel işlev, her sayfadaki verileri özetler
sayfa Durum sütununa göre belirlenir. Komut dosyası
toplama işlemine dahil edilmemesi gereken sayfalar (ör. ReadMe ve
Özet sayfaları
Apps Komut Dosyası hizmetleri
Bu çözüm aşağıdaki hizmeti kullanır:
- E-tablo hizmeti: E-tabloları alır belirli bir öğeyle eşleşen öğeleri sayarak belirtilen dizeyi kullanın. Daha sonra, komut dosyası hesaplanan bilgileri bir aralığa ekler fonksiyonun e-tabloda çağrıldığı yere göre yapılır.
Ön koşullar
Bu örneği kullanmak için aşağıdaki ön koşullara sahip olmanız gerekir:
- Google Hesabı (Google Workspace hesapları (yönetici onayı gerektirir).
- İnternete erişimi olan bir web tarayıcısı.
Komut dosyasını ayarlama
E-tablo verilerini özetle sayfasının bir kopyasını oluşturmak için aşağıdaki düğmeyi tıklayın
özel işlev e-tablosunu seçin. Şu kullanıcı için Apps Komut Dosyası projesi:
bu çözüm e-tabloya eklenir.
Kopya oluştur
Komut dosyasını çalıştırma
- Kopyaladığınız e-tabloda Özet sayfasına gidin.
A4
hücresini tıklayın.getSheetsData()
işlevi bu hücrededir.- Sahip sayfalarından birine gidin ve sayfayı güncelleyin veya sayfaya veri ekleyin. Biraz
deneyebileceğiniz işlemler şunlardır:
- Örnek bilet bilgilerini içeren yeni bir satır ekleyin.
- Durum sütununda, mevcut bir biletin durumunu değiştirin.
- Durum sütununun konumunu değiştirin. Örneğin, Owner1 sayfasındayken Owner1 sütununu C sütunundan D sütununa taşıyın.
- Özet sayfasına gidin ve
A4
hücresindengetSheetsData()
oluşturuldu. Onay kutusunu işaretlemeniz gerekebilir 10. satırdaki adımları uygulayarak özel işlevin önbelleğe alınmış sonuçlarını yenileyin. Google, performansı optimize etmek için özel işlevleri önbelleğe alır.- Satırları eklediyseniz veya güncellediyseniz komut dosyası, bileti ve durumu günceller. sayılır.
- Durum sütununun konumunu taşıdıysanız komut dosyası çalışmaya devam eder amaçlandığı gibi yeniden adlandırabilirsiniz.
Kodu inceleyin
Bu çözüm için Apps Komut Dosyası kodunu incelemek üzere Kaynak kodunu göster'i tıklayın aşağıda bulabilirsiniz:
Kaynak kodu göster
Code.gs
Değişiklikler
Özel işlevi, ihtiyaçlarınıza göre istediğiniz kadar düzenleyebilirsiniz. Şunun altında: özel işlev sonuçlarını manuel olarak yenilemek için kullanılan isteğe bağlı bir eklemedir.
Önbelleğe alınan sonuçları yenile
Google, yerleşik işlevlerin aksine, optimizasyon için özel bazı yolları da görmüştük. Bu, özel boyutlarınızda bir şeyi değiştirirseniz, işlevi kullanılarak (ör. hesaplanmakta olan bir değer) hemen güncellemeye zorlayın. İşlev sonucunu manuel olarak yenilemek için aşağıdaki komutu alın için şu adımları izleyin:
- Ekle'yi tıklayarak boş bir hücreye onay kutusu ekleme > Onay kutusu'na dokunun.
- Onay kutusu işaretli hücreyi özel işlevin parametresi olarak ekleyin.
örneğin,
getSheetsData(B11)
. - Özel işlev sonuçlarını yenilemek için onay kutusunu işaretleyin veya kutunun işaretini kaldırın.
Katkıda bulunanlar
Bu örnek, Google Geliştirici Uzmanları'nın yardımıyla Google tarafından yönetilir.