2

I like to have each of my form responses aligned in the center of their cells. However when I submit any new information through Google Forms, they are always automatically aligned to the left, and so I am forced to constantly go back and highlight all of these cells and click Format → Align → Center.

Is there someway I can have my form responses automatically aligned in the center after each new submission? Or do I always have to go back and align them myself later?

  • 1
    When you did Format -> Align -> Center, did you select just the existing cells, or the entire column? If you select the entire column (by clicking on the column header), and then make your format selections, I believe it should apply to new rows also. – Vidar S. Ramdal Jun 16 '14 at 9:56
  • This is not currently working on the new google sheets. It's a bug. – Ysasmendi Aug 5 '14 at 9:05
  • Reference please? – Jacob Jan Tuinstra Aug 5 '14 at 9:13
3

It looks like this issue is due to a bug in the new Google Sheets, but you can use this simple script as a workaround.

  • In your sheet, go to Tools > Script Editor. Erase the existing code in Code.gs and add this instead:

    function setCellAlign(range, alignment) {
       var ss = SpreadsheetApp.getActiveSpreadsheet();
       var sheet = ss.getSheets()[0];
       var cell = sheet.getRange(range);
       cell.setHorizontalAlignment(alignment);
     }
    function onFormSubmit() {
       setCellAlign("A1:F500", "center");
    }
    
  • In the second-to-last-line, change F500 to the expected bottom-right cell of your sheet. For example, if your rightmost column is G and you want to hold 1000 responses in your sheet, change the value to G1000 so the second-to-last line is setCellAlign("A1:G1000", "center");

  • Save the script project as "AutoAlign"

  • Within the Script Editor, go to Resources > Current project's triggers. Add a new trigger for onFormSubmit, From the spreadsheet, On form submit, and press "Save."

Your responses should now align automatically to the center. For whatever reason, this script fails to work 1% of the time, but if that happens the next form submission will fix the previous row.

1

Follow these steps

  • Open the Google Spreadsheet file that your form responses are saved into.
  • Select the whole column, by clicking on the column name letter at the top of it - not just a set of rows in it.
  • Apply the alignment you want.

Your selected alignment should now be applied to all new rows that are added to the Sheet from the Form.

(I have just tested this on one of my Forms, and seen that it works for the date-time value which is automatically put into the first column.)

  • 1
    Sorry but this isn't working, if you want I can screen record it for you. – Zach Jun 16 '14 at 11:32
  • Is that an old Google Sheets file or a new one? It definitely worked with the first column of an old one when I tested it earlier. – MaryC.fromNZ Jun 16 '14 at 14:28
  • It's the new Google Sheets, sorry for not specifying. – Zach Jun 17 '14 at 0:35
1
  1. Create a "pivot table report" inside the Responses Sheet (Data → Pivot report table)
  2. in the "Report editor" on the left, insert the values of the Form as "Rows".
  3. format the columns as you like.

How to create and edit a pivot table report in Google Sheets: https://support.google.com/docs/answer/1272900?hl=en

0

More simple script in 2019:

function FormsAdjustementScript() {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getSheets()[0];
    var cell = sheet.getRange("A1:Z1000");
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("center");
}

A1:Z1000 is the ranged area. So it's from A1 to Z1000.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.