簡體   English   中英

Google Scripts / Sheets 添加前綴國際電話

[英]Google Scripts / Sheets Add prefix international phone

感謝您的寶貴幫助。

我有一個谷歌表單,我想激活一個腳本來自動更改客戶輸入的電話號碼。

示例(G 列):例如 [用戶輸入] = [最終單元格值]

3331231646 = +393331231646
3251022878 = +393251022878

我正在嘗試解決這個問題,有人可以幫助我嗎?

多謝

在繼續創建腳本之前,首先添加可安裝觸發器。 請參閱以下有關如何添加觸發器的步驟:

1.)在您的腳本編輯器中,go 到編輯選項卡並單擊當前項目的觸發器在此處輸入圖像描述

2.) 點擊右下角的添加觸發器

在此處輸入圖像描述

3.) 在Select 事件類型下拉列表中,select在表單上提交在此處輸入圖像描述

4.)如果出現身份驗證,只需 select 您的帳戶,然后單擊允許

5.) 單擊保存后,您將看到這些詳細信息在此處輸入圖像描述

這是我可以實現此目標的示例腳本:

function onEdit(e) {
    var range = e.range;
    var responseArray = e.values;
    var countryCode = "+39";

    //For this part, you just need to change the index[] to the specific column of mobile number in your spreadsheet, count starting from 0, equivalent to column A. 
    //In my sample, the column of mobile number on my spreadsheet is at column G, so the index I indicated was 6.
    responseArray[6] = countryCode + e.values[6]; 
    //A Range object is representing the cell or range of cells that were last added/inputted in the spreadsheet from the form.
    range.setValues([responseArray]);
}

請參閱下面的示例 output:

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM