Google Sheets setRowHeight() auto-fitting, NOT resizing to set value
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
add a comment |
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
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
add a comment |
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
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
google-apps-script google-sheets
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
It appears that
setWrap
andsetWraps
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.
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
add a comment |
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:)
New contributor
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
It appears that
setWrap
andsetWraps
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.
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
add a comment |
It appears that
setWrap
andsetWraps
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.
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
add a comment |
It appears that
setWrap
andsetWraps
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.
It appears that
setWrap
andsetWraps
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.
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
add a comment |
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
add a comment |
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:)
New contributor
add a comment |
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:)
New contributor
add a comment |
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:)
New contributor
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:)
New contributor
New contributor
answered yesterday
Jane BeeJane Bee
1
1
New contributor
New contributor
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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