0

I am new to Scripts - trying to create a script where when data is added to this sheet, ColumnA is automatically formatted as text, with no decimals.

enter image description here

        function myFunction() {
      /** @OnlyCurrentDoc */
    
    function MakeColAnumeric() {
    var spreadsheet = SpreadsheetApp.getActive();
    spreadsheet.getRange('A:A').activate();
    spreadsheet.getActiveRangeList().setNumberFormat('#,##0');
    };
    }

This is what I have tried so far, with no luck. Would appreciate it if anyone can point me towards the correct way.

Luke
  • 1
  • Does this answer your question? [Format a Google Sheets cell in plaintext via Apps Script](https://stackoverflow.com/questions/13758913/format-a-google-sheets-cell-in-plaintext-via-apps-script) – A. Perez Cera Mar 17 '21 at 13:28
  • Great question as it is poorly documented in Google Apps Scripts documentation, but the question is not how to convert text to number, rather how to set the cell formatting to text. – A. Perez Cera Mar 17 '21 at 13:30
  • May I ask the following questions to further understand your goal, (1) Is the data added to the sheet was done manually? where user will type the data in the sheet. (2) Is it possible for the user to type a value in column A with decimal? (3) Is setting the whole column A's number format to plain text manually will not resolve your concern? Select Column A then go to Format -> Number -> Plain text – Ron M Mar 17 '21 at 16:44

0 Answers0