--
You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/5zEvLSKcPdg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/d6a0cd00-d7e7-438e-868d-28b901f7570fn%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/41c47785-f2bb-4e29-bfe3-ee6111a5ca06n%40googlegroups.com.
Sorry, there is an error here: (a.getFullYear() + 1);Try this instead >function getStudents() {let a = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Adhérent"), b = a.getDataRange().getValues(), c, d;for (let i = 0; i < b.length; i++) {c = b[i][1],d = (1 + c.getFullYear()) + "," + c.getMonth() + "," + c.getDate();b[i].splice(1, 1, d);}a.getRange(1, 1, b.length, b[0].length).setValues(b);};
On Monday, 31 October 2022 at 14:32:30 UTC+3 asreuni...@gmail.com wrote:
Supermais à l'execution j'ai ceci
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/3c743635-e088-4579-8932-b9c88deca1afn%40googlegroups.com.
- You are right. By initialising i at 0 instead of 1, the function is trying to process the word "Nom" as a date. That is why I said that if it finds something that is not a date, it might throw an error. The solution, of course, it to initialise i at 1.
- getMonth() returns values from 0 to 11, so December would be 11. To fix this, simply adjust the function to read like this > (1 + c.getMonth()).
- getDate() should be fine. I don't see why it is one day behind.
- I'm using the splice function to replace the old date format with the new format. Please click here to learn how to use the function. It is quite powerful.
On Monday, 31 October 2022 at 15:54:10 UTC+3 asreuni...@gmail.com wrote:
Je crois que l'erreur vient de l'initialisation de la boucle let i=1 et non = 0J'ai bien des dates sur la colonne B, mais il y a quelque chose d'étrangeMon tableauet le résultat de la macro donne ceciLe mois devient 11 au lieu de garder 12 et le jour 30 au lieu de 31Etrange. Auriez vous une idée ?Excusez moi c'est ma première traduction d'une macro Excel,en Google script, et je ne connais pas assez de fonctions, mais quel est le rôle de l'instruction splice ?Merci encore
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/6074f374-04f0-4181-ac46-57501c015dddn%40googlegroups.com.
J'ai modifié la mise en page de la date pour obtenir un format aux normes françaises, comme ceciIl y a un problème : l'exécution ne s'arrête pas.La mise à jour du champ "validité" voir mail précédent, ne s'effectue pas, bizarre n'est-ce pas ?Pourtanta.getRange(1, 1, b.length, b[0].length).setValues(b);devrait faire le job.
Désolé, tout fonctionne bien. C'est que ma table fait plusieurs milliers de lignes et il fallait attendre la fin du script.Encore merci beaucoup Andrew
Good day Leonfort!
I see an issue in your code. Change b.lenght to b.length.That should fix it.
On Tuesday, 1 November 2022 at 12:42:44 UTC+3 asreuni...@gmail.com wrote:
Hi Andrewdésolé de vous déranger encore une fois.Hier soir tout fonctionnait bien et ce matin plus rien, pourtant je n'ai rien modifié, voici le compte-rendu de l'exécutionTout ce qui dans la boucle For ne s'exécute pas , bizarre n'est-ce pas. La macro n'a pas changéeAuriez-vous une idée ? Merci d'avance
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/fec32926-de9c-4009-b927-7935e4e2993an%40googlegroups.com.