How do I replace text in a spreadsheet with Google Apps Script?

后端 未结 7 651
慢半拍i
慢半拍i 2020-12-01 17:30

I wanna find a specified text in spreadsheet and replace it with other word. I tried like this.

sheet = SpreadsheetApp.getActiveSheet()
sheet.replaceText (\'         


        
相关标签:
7条回答
  • 2020-12-01 18:19

    TextFinder was released April of 2019:

    function textFinder() {
      const sheet = SpreadsheetApp.getActiveSheet();
      const range = sheet.getDataRange();
      // Creates  a text finder for the range.
      const textFinder = range.createTextFinder('findValue');
      const allOccurrences = textFinder.replaceAllWith('replaceValue');
    }
    
    0 讨论(0)
提交回复
热议问题