Google Script - Function to unmerge cells? - function

I'm in the process of automating one of my weekly reports - however part of this process involves the merging of cells and unmerging - currently unmerging is done seperatly however im just wondering if such a method exists to find cells that are merged and unmerge them?
Many thanks.

My answer to this question will be "clear formatting" Option in Format menu.

GAS has a method to unmerge cells but unfortunately there is no way to know which cells are merged.
Some users have suggested a few workarounds, the one I prefer is described in this post: Split (break apart) merged table cells in google spreadsheet with an apps script
There is also an enhancement request and interesting suggestions mentioned in this post: How do I know if spreadsheet cells are merged using google apps script

Paste the data in Excel , unmerge all the cells and past it back in google sheets , confirm by wrapping the text in the column where there were Merged cells.
simple
copy from google sheets
Paste in Excel
unmerge all the cells in Excel
paste in google sheets .

Related

In Google Sheets, is there a way to see when a cell was populated?

I've got a spreadsheet that has data added to it sporadically. I'd like to know when data was entered into certain cells.
Is there a way to find the date when a cell was populated?
Note: there are several thousand populated cells, so just looking at past iterations of the entire sheet is not going to work.
Right click the cell and then select "Show edit history"
Reference
View the activity on your Google Docs, Sheets & Slides
Related
GoogleSheets - Is there a way to extract user info from "show edit history" to a cell?
Is cell edit history accessible programmatically in Google Apps Script?

Google Sheets calculation methodology through scripts

I am working with a large Google Sheet file. It has 10 sheets, each large with many sumproducts on them. Is there a way to "turn off" and "turn on" the calculation of the spreadsheet from inside a script function. I do a lot of single cell updating and don't need all the sheets to recalculate. I am assuming Google Sheets is recalculating all associated cells everything every time I update a cell. (I think I am looking for the opposite of .flush(), but not sure)
Also: if anyone knows of a good book that goes over Googles Sheets permissible Script commands, with examples, please let me know.

Google Script Insert Formula to Non-Consecutive Cells

I've been searching for a solution for a while and have not been able to get one. I am new to Google apps script and appreciate any help with this newbie question.
Here is what I have:
spreadsheet.getRangeList(['I5', 'I10', 'I15', 'I20']).setFormula('=SUMIFS(Sheet1!$EZ:$EZ,Sheet1!$BV:$BV,"Criteria",Sheet 1!$L:$L,$A5)');
The problem is it will paste that formula to each of the cells without changing the $A5 to $A10, $A15 and $A20, respectively.
Is it possible to do what I am asking?
Instead of using setFormula use setFormulaR1C1
Related
How do I add formulas to Google Spreadsheet using Google Apps Script?

Google Scripts Generated VLOOKUP Formula Does not Calculate Properly

I am writing formulas to cells programmatically.
The following line of code:
formulaCells.setFormulaR1C1('=iferror(VLOOKUP(R[0]C[3],AutoCat!A:B,2,FALSE),"Requires Category")');
Adequately writes this formula into all the cells in the target Google Sheets file represented by formulaCells
=iferror(VLOOKUP(D2,AutoCat!A:B,2,FALSE),"Requires Category")
But the problem is that the formula defaults to the error flag "Requires Category" when it is written by Google Scripts, but if I write the very same formula manually into Google Sheets, the actual item identified by the VLOOKUP results.
This is so frustrating!
If I hover over the Google Script generated formula, the true solution from the VLOOKUP even appears in the flyover, but for some reason, does not appear in the cell.
Please help! Why will a Google Scripts generated formula not calculate properly wen the same formula entered manually will?
OK, after thinking I'd exhausted my mental resources on this, I tried one last thing, and it actually worked.
For some unknown reason, though the formula is accurate, Google Scripts generated formulas do not play well with a VLOOKUP which searches an unlimited range for a solution. So even though the VLOOKUP was finding the correct solution, it was not displaying it as the formula result.
I fixed this by creating in the Google Sheets file a named range of the data the VLOOKUP would search called AutoCategory, and then inserted that named range into the Google Scripts generated formula, and BOOM! the formula started working.
Here is the final code in Scripts:
formulaCells.setFormulaR1C1('=iferror(VLOOKUP(R[0]C[3],AutoCategory,2,FALSE),"Requires Category")');
And here is the final formula which is generated in Google Sheets:
=iferror(VLOOKUP(D2,AutoCategory,2,FALSE),"Requires Category")
setFormulaR1C1 requires R1C1 notation, which you provided with R[0]C[3], but AutoCat!A:B is A1 notation.
You could switch to setFormula() and pass in only A1 notation, but I think that using named ranges is a very good practice when combined with Google Apps Script.

merge two google forms data into the one spreadsheet

I want to create application which takes two different google forms data into the one spreadsheet and having two different sheets there on a single spreadsheet with the help of google apps script.
I've searched over a lot but hadn't find any satisfactory solution. Can anyone tell me that is that possible to acheive with google-apps-scripts?
Sorry, I don't have any piece of code this time.
It is impossible to insert data of two Google Forms directly to a single spreadsheet using GAS without involving another two spreadsheets, because now the Forms are able to deploy data only to own spreadsheet and GAS has no any service to access to the Forms.
There is a workaround which merges the Forms spreadsheets to a single spreadsheet using the ImportRange function (see bellow paragraph) but seems it is not suitable for you.
The spreadsheets have the ImportRange function which permits to import a source spreadsheet range to a destination spreadsheet, for instance, there is a task to import spreadsheet_1 columns A, B, C of Sheet1 and spreadsheet_2 columns B, C of the Sheet2 to spreadsheet_0 columns F, G, H, I and J. To achieve it is necessary to place to the spreadsheet_0 cell F1 the =ImportRange("spreadsheet_1_key", "Sheet1!A:C") formula and the cell I1 should contain the =ImportRange("spreadsheet_2_key", "Sheet2!B:C") formula.
For anyone who ends up at this question, looking for some general knowledge, you can change the form destination. In the form editor, choose RESPONSES, CHANGE RESPONSE DESTINATION. The form responses can be sent to another spreadsheet. I'm not sure if this is a capability that didn't exist when this question was first asked, but for anyone doing a general search, you might end up here.