I have a spreadsheet: https://docs.google.com/spreadsheets/d/1df2cp4DsJvSeBvhsNjLgIa5x_RO1X7s_APRdFzU6jqQ/edit?usp=sharing
| | C | D |
|----+---------------------------------+----------------|
| 1> | From IFTTT | Extracted Date |
| 2> | 0809 1800 0909 0600 RLK Steiger | 08.09.2020 |
| 3> | 0809 1800 0909 0600 RLK Dvorak | 08.09.2020 |
| 4> | 0909 0600 0909 1800 UNIS Brando | 09.09.2020 |
Where I get automaticly SMS trought the android program "IFTTT" I have there then formulas to count the hours worked, date etc. that is taken from the SMS body.
| | C | D |
|----+---------------------------------+-------------------------------------------|
| 1> | From IFTTT | Extracted Date |
| 2> | 0809 1800 0909 0600 RLK Steiger | =MID(C2,1,2)&"."&MID(C2,3,2)&".2020" |
| 3> | 0809 1800 0909 0600 RLK Dvorak | =MID(C3,1,2)&"."&MID(C3,3,2)&".2020" |
| 4> | 0909 0600 0909 1800 UNIS Brando | //<= New row from IFTTT. Set formula here |
I have now the issue that the android program will always put the SMS to the last blank row. So I can't have the formulas pre-set there, because then it goes under the formulas and it's useles unles done by hand.
I've tried with Google Apps Scripts. Is there anyway how to do that by the Google Sheets macros? I've tried the following:
function myFunction() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('D1').activate();
spreadsheet.getCurrentCell().setFormula('=if(isnumber(A1);mid(C1;1;2)&"."&mid(C1;3;2)&".2020";""))
However if it's used, then it won't leave the cell empty, but with the formula in it and also I would have to do this for each cell. My idea was that if(set the formula) else delete it, but I don't know how to write that in Javascript.
Ideally it would be that if column D:D
last row contains text, then use the formulas I have there, but I don't know how to do that either.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…