I am creating a PO form for my department. I have 2 cells merged with text wrap for the item description. If I copy a product name from Amazon and paste it into these merged cells, the merge breaks and text does not wrap. If I take the same text and paste into google search bar and then recopy the text and paste into the merged cells everything functions as normal. It does not appear to be the length of text but rather the font size that is the issue. Paste special- values only also fixes the problem but I am trying to make this form usable without special instructions. Does anyone have a work around or at least confirm font size can break a cell merge?
Font size is not relevant. You're copying a special character (likely a newline) at the end of the product name, which causes the merged cells to split.
There isn't anything you can do on your side to fix this, copy pasting formatted text directly from a webpage into your sheet will lead to things breaking.
A few options:
Double click on the merged cell, then paste the text into it
Select the merged cell and paste the values into the formula bar
Paste Special - Values
Answer:
I can confirm this does happen.
Workaround:
Instead of merging cells like this:
You can just use one cell and expand its width:
Fixing Font Size:
The only issue here is that if you paste in some text which is font size 18 and Times New Roman, if you don't use the Right Click > Paste Special > Paste values only then the text decoration will persist. You can fix this with a little script which changes the font to normal on edit:
function onEdit(e) {
e.range.setFontSize(10)
.setFontWeight("normal")
.setFontFamily("Arial")
.setFontColor("black")
}
This you will need to paste into the script editor for your sheet, by following the Tools > Script editor menu item. Once pasted, you will need to save the script with Ctrl+S. Anything pasted will now automatically be converted to Arial, size 10, black, normal weight font:
Related
I have a spreadsheet created with importrange functions that pulls data from another file. The problem I'm facing is that when I try to print out the spreadsheet and save as pdf, the pdf includes all the cells I've set up to receive my data, the empty ones too, and I end up with a 4 page pdf with 3 empty pages.
I tried to put a filter() function in front of the importrange, so that if the importrange somehow imports null values and puts them in the empty cells making them no empty even though they look like it, that would do it, it didn't.
I've also read that google spreadsheet interpretes white background color as fill color, and to set it back to default background, and I did, but it didn't solve it.
I've removed the importrange functions at all to see if it was that that was doing it, it wasn't.
Finally, I've thought about formatting, because those cells are formatted with white borders, but I removed all custom borders and it still prints out all the cells.
To reiterate, I need to be able to do print > save as pdf and get a pdf that contains only the cells used, and I have an old spreadsheet that I'm improving upon that does exactly this (that is not made by me) and has very similar formatting, so I don't understand what's the issue here.
Here's one workaround:
Select the cells you want to include in your PDF
Click on "File" > "Download" > "PDF"
When the Print Settings/Export window appears, select "Selected cells" instead of "Current sheet" under "Export" in the top right corner
This screen capture shows the window in question.
Bois, I figured it out.
It's a pretty dumb thing, but I didn't know it.
The solution is absolutely no formatting of any kind, it's ok to have formulas that dont output anything, and custom text color for the cell, but all the cells must be separated and with default background color and default border color (AKA no border option).
What kept bugging me is the fact that my reference project had no cell borders and it had this loong table that never printed out if not necessary, and I assumed it had white borders, but it didn't.
Turns out the option to hide cell borders (VIEW > SHOW > GRID LINES) at all is connected to the spreadsheet itself, not the user, so if you disable it, everytime you open the file, from every account connected, it is not gonna show, so that's how they did it.
In a financials spreadsheet I have to insert a lot of Links, and Sheets always increases the font size, eg from the default 10 to 12.
Also, when I paste a formula into a cell, both the font size and colour get changed.
Is there a setting to prevent this annoying behaviour?
after your paste you can press CTRL + A and CTRL + \
this will result in defaulting the formatting
or you can try CTRL + SHIFT + V
and the 3rd option would be to use mediate paste... copy and paste it somewhere where formatting is not supported like address bar, notepad (txt file), translate.google.com box... and then copypaste it into your sheet
there is also another option if your paste is only in one cell (not across cells). you either double click on the cell and then paste it or paste it right into formula bar/box instead of the cell
I want all cells of a Google sheet to be formatted identically (same font, same font size, same wrapping, same alignment). However, even if I select the whole sheet and set all formatting values, every time I enter a new value in an empty cell (sometimes copy-pasted from web pages, sometimes typed), the 'preset' formatting specs seem to have been lost and I must respecify them. Does someone know of a way to make the preformatting stick?
Copying and pasting the usual way brings with it the formatting of the source as best as Sheets can manage. Instead of using "Paste" or Ctrl-V, use "Paste Special" (Ctrl-Alt-V). A small clipboard icon will appear to the lower right of the on-screen paste area. Click it and choose "Paste values only."
This must be done even if you paste from one sheet within Google Sheets to another. If you just paste the regular way, it not only brings in the formatting of the source sheet, it breaks up any existing conditional formatting ranges you have in place.
Try using CTRL+SHIFT+V to paste. Doing so will only paste the copied value to the sheet without affecting the formatting.
Potential workaround:
With Apps Script you can run a simple onEdit() trigger to run every time an edit is made on the sheet. So you could use this to run a script that changes the format of cells every time an edit is made.
This would involve getting the whole data range and getting the rich text values of each cell, making a copy of the rich text value object and modifying it with the RichTextValueBuilder. This is turn involves copying and modifying the TextStyle with the TextStyleBuilder.
The wrapping and alignment are set on the whole range with setWrap(isWrapEnabled) and setHorizontalAlignment(alignment).
Example
function onEdit() {
// initialize main variables
let file = SpreadsheetApp.getActive();
let sheet = file.getSheetByName("Sheet1"); // change to your sheet name
let range = sheet.getDataRange();
// This sets the whole range wrap and alignment
range.setWrap(true);
range.setHorizontalAlignment("center")
// Get the rich text values in a 2D array
let richTextValues = range.getRichTextValues();
// Two map functions to return the modified 2D array.
let newRichTextValues = richTextValues.map(row => {
return row.map(cell => {
// Gets the text style from the richText value
let style = cell.getTextStyle()
// Copy the text style and set the bold, font and size
let styleCopy = style.copy()
.setBold(true)
.setFontFamily("Comfortaa")
.setFontSize(11)
.build();
// Set the new rich text value
let newRichTextValues = cell.copy()
.setTextStyle(styleCopy)
.build();
return newRichTextValue
})
})
// Set the whole range to the rich text value.
range.setRichTextValues(newRichTextValues)
}
This should work as-is by copying this into the script editor, trying to run it once from there to get the authorizations done, and then editing your sheet. Remember to add in your sheet name.
Demonstration
This is what it looks like in action:
In this example, I used
Text wrapping as on.
Center alignment
Bold text
"Comfortaa" font
11 font size
You should change these attributes to the ones that you want. There are other attributes available to customize too.
As you can see, it could get a bit tricky if you need to exclude certain ranges, but this is absolutely possible depending on your exact use case.
It should also be mentioned that this is quite an inefficient approach, as it gets the whole range and updates everything. Ideally you want to identify the exact changes and update those, but again, this depends on your exact use case. To get the range that was modified with an onEdit trigger you can use the Event object.
References
simple onEdit() trigger
RichTextValue
RichTextValueBuilder
TextStyle
TextStyleBuilder
setHorizontalAlignment(alignment)
setWrap(isWrapEnabled)
Event object
This may be the most niche question ever but let's try it anyway.
I have a Google Sheets spreadsheet that contains cells with multiple lines of text. Each line of text is separated by a soft break.
As shown below, when I copy the contents of a cell (row 2 in the screenshot) from the Google Sheets app to the Instagram caption box, a quote mark is added to the beginning and end of the caption.
If I copy the contents of a cell and that cell has only a single line of text (row 3 in the screenshot), no quote mark is added.
I am using an iPhone 11 running the latest version of iOS.
The extra quotes are added when there are special characters in the cell. In your scenario, the Line Feed characters are causing this. Definitely annoying.
There is a way around this – using Carriage Return characters, rather than Line Feeds to separate each line. For some reason these characters don’t cause the quotation marks to appear.
One thing you can do in your sheet is to create a helper cell that will take your text, and replace the line feeds with carriage returns (assuming your input text is in cell A2, add this formula to an empty cell):
=SUBSTITUTE(A2,char(10),char(13))
The output for this will look like it doesn’t contain linefeeds, but when you copy & paste from that cell, the linefeeds will be there in the pasted text, without the extra quotation marks.
The quotations are inserted by the target application when non-printable or otherwise incompatible characters appear in the copied text. There are several scenarios in which the quotes don't appear, and several in which they do.
For example in the MacOS Notes application, consider a cell containing either a vertical tab (appearing as a line break in a single cell with a Cmd-Enter on Mac or Cntl-Enter on Windows) or a newline character in a formula such as ="test"&char(10)&"test". When copied and pasted into a record in Notes, the text is copied as is (i.e., as expected). However when pasting into the Notes search box, the quotes appear, such as described in the question.
There appear to be 3 alternative ways to handle this issue:
Strip the non-printable characters with a formula
Using the CLEAN function, the characters will be stripped. This will produce oft undesirable results, but will eliminate the quotes. See the Wrapped in CLEAN column:
Paste elsewhere first
In the Notes example, one can paste the offending text into a Note (or presumably any text editor.) The offending quotes are omitted. The text can then be recopied and repasted without quotes. This will still collapse a line feed into a space:
Publish to Web and copy from there
Publishing a sheet with non-printable characters enables quoteless copy, like the previous option, but may be a preferable. See the test sheet
Copy from the Sample Text column. You can paste without quotes, but the line break is stripped and replaced with a space as above.
this is a common issue. the solution would be to paste your copy into fx bar instead of cell selection. this way you can skip the additional quotes
The easiest of the easiest solution is to copy straight from the cell. Mark the text within the cell instead of marking the whole cell and then copy.
its very easy guys
just follow as i say
step1: type letter in a cell
step2: select logo(A) with 4 dash(-) which is on top
step3: select cell
step4:turn on wrap text
problem solved
if you are using desktop
mac: alt/opttion+enter
windows: alt+enter
you can also select all cell at once then you can select format on menu bar and select text warping and then wrap(this is not recommended as it may destroy your table format)
Is there a way to remove the conditional formatting from cells, while keeping the applied format intact?
The only way I've found is:
Copy the cells.
Clear formatting on the cells (ctrl + \)
Paste special -> Paste format only (paste over the said cells).
Copy a cell that has no conditional formatting
Select the cells with de conditional formatting you want to delete
Click Edit > Paste special > Paste conditional formatting only.
Yes, to remove individual conditional formats while leaving other formatting unchanged, in Google Sheets:
If the conditional format pane on the far right is present, close it by clicking the X in the top right of the pane.
Highlight the range of cells (or select a single cell if you want to remove conditional format for only 1 cell) that have conditional formatting applied. For this to work, at least one of the cells you've highlighted must have conditional formatting defined.
Right click the highlighted cells and select "Conditional Formatting" from the context menu.
A vertical panel on the right will appear with a list of conditional format rules that are present in the highlighted range.
Hover the cursor (do not click -- just hover) over the rule you want to delete. As you hover a trash can icon will appear.
Click the trash can icon to remove that particular conditional format.
Copy the required range to another sheet and paste special, values only. Then immediately paste special again, formatting only.
If you want to keep the work in the same place on the same sheet, just cut instead of copy, and then do the above paste operations to the same place.
The advantage of the first method is that by creating a copy you can't accidentally mess up your original and can always replace this when you are satisfied with the result.
I know this is an old question, but I tried the approaches suggested. They don't work. The conditional formatting 'çonditions' are also copied across.
My Solution is to copy and paste into excel and then copy the values back into google sheets.
When pasting into excel the 'conditions' don't get copied over.
Some Redditor saved the day!
Here's the link
function clearFormatting () {
var s = SpreadsheetApp.getActiveSpreadsheet();
var ss = s.getActiveSheet();
ss.clearConditionalFormatRules();
}
To add to the most-voted answer, you can actually do this on an entire sheet, in case that's helpful. (Mac keys shown here)
Command-a to Select All
Command-c to Copy
Command-\ to Clear Formatting
Command-Option-v to Paste Format Only
Without a script is possible with a hack: copy into say Word and back again.