Please tell me how to display the initial number 0 of the number answered from Google form on the spreadsheet.

Asked 1 years ago, Updated 1 years ago, 40 views

If you answer a number from the Google form, it will be stored in the spreadsheet with 0 at the beginning of the sentence disappeared.
Is there any way to store it in a spreadsheet with 0 left at the beginning of the sentence?

▼Tried
·Add one extra line at the top and bottom of the line where the latest answer is stored, and both format the text without formatting, but the answer remains numeric and 0 disappears at the beginning of the sentence.
·Even if you try to fill in the script editor in the form, it will become unformatted text after the beginning of the sentence 0 disappears.

vars=SpreadsheetApp.openById("xxxxxxxx";
varsh=ss.getSheetByName("Answer");

function setFormat(){

    // The column C that you want to text
    sh.getRange(2,3, sh.getMaxRows(), 1).setNumberFormat('@');

}

▼Prerequisite
·The number of digits of the number you want me to send from the form has not been determined (if the number of digits of the number is determined, the '@' in the above script should be '00000000000' etc.)
·As long as I know the value, I don't care about the format of the data to be stored.You can also allow certain characters to be placed at the beginning of a sentence.Example: If you answer 0012AB on Google form, you can put #0012AB at the beginning of a sentence in a spreadsheet.

That's all.I would appreciate it if you could help me.
Thank you for your cooperation.

google-apps-script

2022-09-30 14:36

2 Answers

Basically, it was impossible.
Therefore, I think it would be better for you to enter A0012AB or something with an appropriate prefix on the input side.

Also, I think it would be better to force this prefix A with input rules.


2022-09-30 14:36

 varrng = sh.getRange(2,3, sh.getMaxRows(), 1);
rng.setNumberFormat("0000AB");

Try adding


2022-09-30 14:36

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.