Google Sheets setRowHeight() auto-fitting, NOT resizing to set value












0















I've a Google form/sheet which collects data creating cells that are so large that navigating up and down rows becomes tricky.



The below function should resize all rows (except the header row 1) to 50.
However, when it runs, all rows Auto-fit the data, again making it again unwieldy.



var sheetResponses = 'Form responses 3';
var ss = SpreadsheetApp.getActiveSpreadsheet();
var responsesSheet = ss.getSheetByName(sheetResponses);
var responseData = responsesSheet.getDataRange().getValues();

// Sets all rows to a height of 50
function resizeRowsTo50() {
responsesSheet.setRowHeights(2,responseData.length,50);
};


Can anyone spot what I've done wrong? Even if I manually resize all of the rows to a uniform height beforehand, the function reverts them back to fit the data.



Thanks in advance.



Edit: Link to Sheet










share|improve this question

























  • I've run your code several times, as-is and with some mods - same result every time: no problems, changes the row height to 50 and nothing more. I wonder whether you have a local setting for Text Wrapping (Format>Text Wrapping) that is interfering with the results. I started with a blank sheet and my Text Wrapping is set to "overflow". Only other suggestion is to share your sheet so that I can see the Auto-Fit phenomena first hand.

    – Tedinoz
    Dec 11 '18 at 2:38











  • Thanks for looking at this for me. I just tried it with all 3 Text Wrapping settings and it's still auto-fitting rather than resizing to 50. Unfortunately I cant share the sheet as it's confidential but if I can replicate the problem with some dummy data, I'll link it here. I'll stick with manually resizing for now.

    – MikeT
    Dec 12 '18 at 11:09











  • Yep, that is worthwhile. May I suggest that you make a copy of your original sheet in order to build the dummy; if it is a setting then best to be working on the original settings rather than a clean sheet.

    – Tedinoz
    Dec 12 '18 at 14:05











  • I've added a link to the dummy sheet showing the same behaviour

    – MikeT
    Dec 13 '18 at 15:21
















0















I've a Google form/sheet which collects data creating cells that are so large that navigating up and down rows becomes tricky.



The below function should resize all rows (except the header row 1) to 50.
However, when it runs, all rows Auto-fit the data, again making it again unwieldy.



var sheetResponses = 'Form responses 3';
var ss = SpreadsheetApp.getActiveSpreadsheet();
var responsesSheet = ss.getSheetByName(sheetResponses);
var responseData = responsesSheet.getDataRange().getValues();

// Sets all rows to a height of 50
function resizeRowsTo50() {
responsesSheet.setRowHeights(2,responseData.length,50);
};


Can anyone spot what I've done wrong? Even if I manually resize all of the rows to a uniform height beforehand, the function reverts them back to fit the data.



Thanks in advance.



Edit: Link to Sheet










share|improve this question

























  • I've run your code several times, as-is and with some mods - same result every time: no problems, changes the row height to 50 and nothing more. I wonder whether you have a local setting for Text Wrapping (Format>Text Wrapping) that is interfering with the results. I started with a blank sheet and my Text Wrapping is set to "overflow". Only other suggestion is to share your sheet so that I can see the Auto-Fit phenomena first hand.

    – Tedinoz
    Dec 11 '18 at 2:38











  • Thanks for looking at this for me. I just tried it with all 3 Text Wrapping settings and it's still auto-fitting rather than resizing to 50. Unfortunately I cant share the sheet as it's confidential but if I can replicate the problem with some dummy data, I'll link it here. I'll stick with manually resizing for now.

    – MikeT
    Dec 12 '18 at 11:09











  • Yep, that is worthwhile. May I suggest that you make a copy of your original sheet in order to build the dummy; if it is a setting then best to be working on the original settings rather than a clean sheet.

    – Tedinoz
    Dec 12 '18 at 14:05











  • I've added a link to the dummy sheet showing the same behaviour

    – MikeT
    Dec 13 '18 at 15:21














0












0








0








I've a Google form/sheet which collects data creating cells that are so large that navigating up and down rows becomes tricky.



The below function should resize all rows (except the header row 1) to 50.
However, when it runs, all rows Auto-fit the data, again making it again unwieldy.



var sheetResponses = 'Form responses 3';
var ss = SpreadsheetApp.getActiveSpreadsheet();
var responsesSheet = ss.getSheetByName(sheetResponses);
var responseData = responsesSheet.getDataRange().getValues();

// Sets all rows to a height of 50
function resizeRowsTo50() {
responsesSheet.setRowHeights(2,responseData.length,50);
};


Can anyone spot what I've done wrong? Even if I manually resize all of the rows to a uniform height beforehand, the function reverts them back to fit the data.



Thanks in advance.



Edit: Link to Sheet










share|improve this question
















I've a Google form/sheet which collects data creating cells that are so large that navigating up and down rows becomes tricky.



The below function should resize all rows (except the header row 1) to 50.
However, when it runs, all rows Auto-fit the data, again making it again unwieldy.



var sheetResponses = 'Form responses 3';
var ss = SpreadsheetApp.getActiveSpreadsheet();
var responsesSheet = ss.getSheetByName(sheetResponses);
var responseData = responsesSheet.getDataRange().getValues();

// Sets all rows to a height of 50
function resizeRowsTo50() {
responsesSheet.setRowHeights(2,responseData.length,50);
};


Can anyone spot what I've done wrong? Even if I manually resize all of the rows to a uniform height beforehand, the function reverts them back to fit the data.



Thanks in advance.



Edit: Link to Sheet







google-apps-script google-sheets






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 13 '18 at 15:17







MikeT

















asked Nov 22 '18 at 11:39









MikeTMikeT

34




34













  • I've run your code several times, as-is and with some mods - same result every time: no problems, changes the row height to 50 and nothing more. I wonder whether you have a local setting for Text Wrapping (Format>Text Wrapping) that is interfering with the results. I started with a blank sheet and my Text Wrapping is set to "overflow". Only other suggestion is to share your sheet so that I can see the Auto-Fit phenomena first hand.

    – Tedinoz
    Dec 11 '18 at 2:38











  • Thanks for looking at this for me. I just tried it with all 3 Text Wrapping settings and it's still auto-fitting rather than resizing to 50. Unfortunately I cant share the sheet as it's confidential but if I can replicate the problem with some dummy data, I'll link it here. I'll stick with manually resizing for now.

    – MikeT
    Dec 12 '18 at 11:09











  • Yep, that is worthwhile. May I suggest that you make a copy of your original sheet in order to build the dummy; if it is a setting then best to be working on the original settings rather than a clean sheet.

    – Tedinoz
    Dec 12 '18 at 14:05











  • I've added a link to the dummy sheet showing the same behaviour

    – MikeT
    Dec 13 '18 at 15:21



















  • I've run your code several times, as-is and with some mods - same result every time: no problems, changes the row height to 50 and nothing more. I wonder whether you have a local setting for Text Wrapping (Format>Text Wrapping) that is interfering with the results. I started with a blank sheet and my Text Wrapping is set to "overflow". Only other suggestion is to share your sheet so that I can see the Auto-Fit phenomena first hand.

    – Tedinoz
    Dec 11 '18 at 2:38











  • Thanks for looking at this for me. I just tried it with all 3 Text Wrapping settings and it's still auto-fitting rather than resizing to 50. Unfortunately I cant share the sheet as it's confidential but if I can replicate the problem with some dummy data, I'll link it here. I'll stick with manually resizing for now.

    – MikeT
    Dec 12 '18 at 11:09











  • Yep, that is worthwhile. May I suggest that you make a copy of your original sheet in order to build the dummy; if it is a setting then best to be working on the original settings rather than a clean sheet.

    – Tedinoz
    Dec 12 '18 at 14:05











  • I've added a link to the dummy sheet showing the same behaviour

    – MikeT
    Dec 13 '18 at 15:21

















I've run your code several times, as-is and with some mods - same result every time: no problems, changes the row height to 50 and nothing more. I wonder whether you have a local setting for Text Wrapping (Format>Text Wrapping) that is interfering with the results. I started with a blank sheet and my Text Wrapping is set to "overflow". Only other suggestion is to share your sheet so that I can see the Auto-Fit phenomena first hand.

– Tedinoz
Dec 11 '18 at 2:38





I've run your code several times, as-is and with some mods - same result every time: no problems, changes the row height to 50 and nothing more. I wonder whether you have a local setting for Text Wrapping (Format>Text Wrapping) that is interfering with the results. I started with a blank sheet and my Text Wrapping is set to "overflow". Only other suggestion is to share your sheet so that I can see the Auto-Fit phenomena first hand.

– Tedinoz
Dec 11 '18 at 2:38













Thanks for looking at this for me. I just tried it with all 3 Text Wrapping settings and it's still auto-fitting rather than resizing to 50. Unfortunately I cant share the sheet as it's confidential but if I can replicate the problem with some dummy data, I'll link it here. I'll stick with manually resizing for now.

– MikeT
Dec 12 '18 at 11:09





Thanks for looking at this for me. I just tried it with all 3 Text Wrapping settings and it's still auto-fitting rather than resizing to 50. Unfortunately I cant share the sheet as it's confidential but if I can replicate the problem with some dummy data, I'll link it here. I'll stick with manually resizing for now.

– MikeT
Dec 12 '18 at 11:09













Yep, that is worthwhile. May I suggest that you make a copy of your original sheet in order to build the dummy; if it is a setting then best to be working on the original settings rather than a clean sheet.

– Tedinoz
Dec 12 '18 at 14:05





Yep, that is worthwhile. May I suggest that you make a copy of your original sheet in order to build the dummy; if it is a setting then best to be working on the original settings rather than a clean sheet.

– Tedinoz
Dec 12 '18 at 14:05













I've added a link to the dummy sheet showing the same behaviour

– MikeT
Dec 13 '18 at 15:21





I've added a link to the dummy sheet showing the same behaviour

– MikeT
Dec 13 '18 at 15:21












2 Answers
2






active

oldest

votes


















1















It appears that setWrap and setWraps override any manual or
programmed (setRowHeight/setRowHeights) row height adjustment.




The documentation for setWrap and setWraps says "Cells with wrap enabled (the default) resize to display their full content" (emphasis is mine). That is, the cell width remains unchanged, and the row height changes to enable display of the entire content.



It goes on... "Cells with wrap disabled display as much as possible in the cell without resizing or running to multiple lines". In the later case, the amount of text displayed otherwise depends on the width of the column.



By comparison, when the settings are adjusted manually (the row height set to 50 pixels and text wrapping set to wrap), the row does not revert to auto-fit.



I've re-run my initial tests and I believe that I may misinterpreted your auto-fit comments when comparing my results. My apologies.



The auto-fit outcome appears deliberate on Google's part - even though the effect is very different to the effect of the manual "Wrap" adjustment. These are relatively new commands (at the time of writing) and there are very few examples to be found online.



I've raised this as a feature issue and we'll see whether that generates any clarification and/or change.






share|improve this answer


























  • Many thanks for looking into this, and no need for apologies! This sounds like a good description of what's happening so I'll be interested to see there is a response to the issue tracker. I've accepted this explanation as an answer as it seems that there is not currently a working resolution.

    – MikeT
    Dec 17 '18 at 9:14





















0














I found a poor decision for me in this tricky way:
- set Wrap to text wrapping;
- set setRowHeight;
- cut the string to such symbols amount which is enough for setted Row Height.
(but you still can see "fit to data" when you trying to resize your row)
I mean I fit my data to my rows hight before google sheet fit hight to my data:)






share|improve this answer








New contributor




Jane Bee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53430183%2fgoogle-sheets-setrowheight-auto-fitting-not-resizing-to-set-value%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1















    It appears that setWrap and setWraps override any manual or
    programmed (setRowHeight/setRowHeights) row height adjustment.




    The documentation for setWrap and setWraps says "Cells with wrap enabled (the default) resize to display their full content" (emphasis is mine). That is, the cell width remains unchanged, and the row height changes to enable display of the entire content.



    It goes on... "Cells with wrap disabled display as much as possible in the cell without resizing or running to multiple lines". In the later case, the amount of text displayed otherwise depends on the width of the column.



    By comparison, when the settings are adjusted manually (the row height set to 50 pixels and text wrapping set to wrap), the row does not revert to auto-fit.



    I've re-run my initial tests and I believe that I may misinterpreted your auto-fit comments when comparing my results. My apologies.



    The auto-fit outcome appears deliberate on Google's part - even though the effect is very different to the effect of the manual "Wrap" adjustment. These are relatively new commands (at the time of writing) and there are very few examples to be found online.



    I've raised this as a feature issue and we'll see whether that generates any clarification and/or change.






    share|improve this answer


























    • Many thanks for looking into this, and no need for apologies! This sounds like a good description of what's happening so I'll be interested to see there is a response to the issue tracker. I've accepted this explanation as an answer as it seems that there is not currently a working resolution.

      – MikeT
      Dec 17 '18 at 9:14


















    1















    It appears that setWrap and setWraps override any manual or
    programmed (setRowHeight/setRowHeights) row height adjustment.




    The documentation for setWrap and setWraps says "Cells with wrap enabled (the default) resize to display their full content" (emphasis is mine). That is, the cell width remains unchanged, and the row height changes to enable display of the entire content.



    It goes on... "Cells with wrap disabled display as much as possible in the cell without resizing or running to multiple lines". In the later case, the amount of text displayed otherwise depends on the width of the column.



    By comparison, when the settings are adjusted manually (the row height set to 50 pixels and text wrapping set to wrap), the row does not revert to auto-fit.



    I've re-run my initial tests and I believe that I may misinterpreted your auto-fit comments when comparing my results. My apologies.



    The auto-fit outcome appears deliberate on Google's part - even though the effect is very different to the effect of the manual "Wrap" adjustment. These are relatively new commands (at the time of writing) and there are very few examples to be found online.



    I've raised this as a feature issue and we'll see whether that generates any clarification and/or change.






    share|improve this answer


























    • Many thanks for looking into this, and no need for apologies! This sounds like a good description of what's happening so I'll be interested to see there is a response to the issue tracker. I've accepted this explanation as an answer as it seems that there is not currently a working resolution.

      – MikeT
      Dec 17 '18 at 9:14
















    1












    1








    1








    It appears that setWrap and setWraps override any manual or
    programmed (setRowHeight/setRowHeights) row height adjustment.




    The documentation for setWrap and setWraps says "Cells with wrap enabled (the default) resize to display their full content" (emphasis is mine). That is, the cell width remains unchanged, and the row height changes to enable display of the entire content.



    It goes on... "Cells with wrap disabled display as much as possible in the cell without resizing or running to multiple lines". In the later case, the amount of text displayed otherwise depends on the width of the column.



    By comparison, when the settings are adjusted manually (the row height set to 50 pixels and text wrapping set to wrap), the row does not revert to auto-fit.



    I've re-run my initial tests and I believe that I may misinterpreted your auto-fit comments when comparing my results. My apologies.



    The auto-fit outcome appears deliberate on Google's part - even though the effect is very different to the effect of the manual "Wrap" adjustment. These are relatively new commands (at the time of writing) and there are very few examples to be found online.



    I've raised this as a feature issue and we'll see whether that generates any clarification and/or change.






    share|improve this answer
















    It appears that setWrap and setWraps override any manual or
    programmed (setRowHeight/setRowHeights) row height adjustment.




    The documentation for setWrap and setWraps says "Cells with wrap enabled (the default) resize to display their full content" (emphasis is mine). That is, the cell width remains unchanged, and the row height changes to enable display of the entire content.



    It goes on... "Cells with wrap disabled display as much as possible in the cell without resizing or running to multiple lines". In the later case, the amount of text displayed otherwise depends on the width of the column.



    By comparison, when the settings are adjusted manually (the row height set to 50 pixels and text wrapping set to wrap), the row does not revert to auto-fit.



    I've re-run my initial tests and I believe that I may misinterpreted your auto-fit comments when comparing my results. My apologies.



    The auto-fit outcome appears deliberate on Google's part - even though the effect is very different to the effect of the manual "Wrap" adjustment. These are relatively new commands (at the time of writing) and there are very few examples to be found online.



    I've raised this as a feature issue and we'll see whether that generates any clarification and/or change.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Dec 15 '18 at 1:41

























    answered Dec 14 '18 at 23:50









    TedinozTedinoz

    96321017




    96321017













    • Many thanks for looking into this, and no need for apologies! This sounds like a good description of what's happening so I'll be interested to see there is a response to the issue tracker. I've accepted this explanation as an answer as it seems that there is not currently a working resolution.

      – MikeT
      Dec 17 '18 at 9:14





















    • Many thanks for looking into this, and no need for apologies! This sounds like a good description of what's happening so I'll be interested to see there is a response to the issue tracker. I've accepted this explanation as an answer as it seems that there is not currently a working resolution.

      – MikeT
      Dec 17 '18 at 9:14



















    Many thanks for looking into this, and no need for apologies! This sounds like a good description of what's happening so I'll be interested to see there is a response to the issue tracker. I've accepted this explanation as an answer as it seems that there is not currently a working resolution.

    – MikeT
    Dec 17 '18 at 9:14







    Many thanks for looking into this, and no need for apologies! This sounds like a good description of what's happening so I'll be interested to see there is a response to the issue tracker. I've accepted this explanation as an answer as it seems that there is not currently a working resolution.

    – MikeT
    Dec 17 '18 at 9:14















    0














    I found a poor decision for me in this tricky way:
    - set Wrap to text wrapping;
    - set setRowHeight;
    - cut the string to such symbols amount which is enough for setted Row Height.
    (but you still can see "fit to data" when you trying to resize your row)
    I mean I fit my data to my rows hight before google sheet fit hight to my data:)






    share|improve this answer








    New contributor




    Jane Bee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.

























      0














      I found a poor decision for me in this tricky way:
      - set Wrap to text wrapping;
      - set setRowHeight;
      - cut the string to such symbols amount which is enough for setted Row Height.
      (but you still can see "fit to data" when you trying to resize your row)
      I mean I fit my data to my rows hight before google sheet fit hight to my data:)






      share|improve this answer








      New contributor




      Jane Bee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.























        0












        0








        0







        I found a poor decision for me in this tricky way:
        - set Wrap to text wrapping;
        - set setRowHeight;
        - cut the string to such symbols amount which is enough for setted Row Height.
        (but you still can see "fit to data" when you trying to resize your row)
        I mean I fit my data to my rows hight before google sheet fit hight to my data:)






        share|improve this answer








        New contributor




        Jane Bee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        I found a poor decision for me in this tricky way:
        - set Wrap to text wrapping;
        - set setRowHeight;
        - cut the string to such symbols amount which is enough for setted Row Height.
        (but you still can see "fit to data" when you trying to resize your row)
        I mean I fit my data to my rows hight before google sheet fit hight to my data:)







        share|improve this answer








        New contributor




        Jane Bee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        Jane Bee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered yesterday









        Jane BeeJane Bee

        1




        1




        New contributor




        Jane Bee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        Jane Bee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        Jane Bee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53430183%2fgoogle-sheets-setrowheight-auto-fitting-not-resizing-to-set-value%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Wiesbaden

            Marschland

            Dieringhausen