Pagina 1 di 1

Macro da esportazione easyfatt a google contact

Inviato: giovedì 16 giugno 2022, 15:39
da coguaro80
Ho questa vecchia macro:

Codice: Seleziona tutto

Sub Google
Sh1 = ThisComponent.Sheets(0)' foglio 1
Sh2 = ThisComponent.Sheets(1)' foglio 2
c = Sh1.createCursor
c.gotoEndOfUsedArea(false)
LR = c.RangeAddress.EndRow + 1
for arow = 2 to LR
  if Sh1.GetCellRangebyName("K" & arow ).string <> "" then
     Sh2.GetCellRangebyName("A" & arow ).string = Sh1.GetCellRangebyName("A" & arow ).string & " " & Sh1.GetCellRangebyName("D" & arow ).string 
     Sh2.GetCellRangebyName("B" & arow ).string = Sh1.GetCellRangebyName("D" & arow ).string 
     Sh2.GetCellRangebyName("I" & arow ).string = Sh1.GetCellRangebyName("A" & arow ).string 
     Sh2.GetCellRangebyName("AC" & arow ).string = "* My Contacts" 
     Sh2.GetCellRangebyName("AB" & arow ).string = "* Home"  
     Sh2.GetCellRangebyName("AE" & arow ).string = Sh1.GetCellRangebyName("Q" & arow ).string 
     Sh2.GetCellRangebyName("AJ" & arow ).string = "Mobile" 
     Sh2.GetCellRangebyName("AE" & arow ).string = "+39" & Sh1.GetCellRangebyName("O" & arow ).string 
     Sh2.GetCellRangebyName("AL" & arow ).string = "* Home"
     Sh2.GetCellRangebyName("AM" & arow ).string = Sh1.GetCellRangebyName("E" & arow ).string & " " & Sh1.GetCellRangebyName("F" & arow ).string & " " & Sh1.GetCellRangebyName("G" & arow ).string & ", " & Sh1.GetCellRangebyName("H" & arow ).string 
     Sh2.GetCellRangebyName("AN" & arow ).string = Sh1.GetCellRangebyName("E" & arow ).string
     Sh2.GetCellRangebyName("AO" & arow ).string = Sh1.GetCellRangebyName("F" & arow ).string
     Sh2.GetCellRangebyName("AQ" & arow ).string = Sh1.GetCellRangebyName("G" & arow ).string & " " & Sh1.GetCellRangebyName("H" & arow ).string 
     Sh2.GetCellRangebyName("AL" & arow ).string = Sh1.GetCellRangebyName("D" & arow ).string
     Sh2.GetCellRangebyName("AM" & arow ).string = Sh1.GetCellRangebyName("H" & arow ).string
     if Len(Sh2.GetCellRangebyName("AG" & arow ).string) = 4 Then Sh2.GetCellRangebyName("AG" & arow ).string = ""
  end if 
next

   MSGBOX "Fine"

End Sub

Non fatta da me che ho provato a ricollegare essendo sia la struttura di esportazione di easyfatt che quella del file di google cambiate.
Purtroppo ho diversi problemi:

Il primo è che mi fà solo la prima riga dopo l'intestazione senza dare errori e non va avanti.
Il secondo non essendo commentata ho problemi a riconoscere le varie colonne.
Il terzo mi servirebbe che venissero divisi in più file csv in quanto google permette l'importazione di massimo 3000 contatti per volta.

Qualcuno mi può aiutare?

In allegato
File soggeti.ods esportazione easyfat.
File contacts ( 1).csv esportazione google ( ho notato alcuni problemi anche nella loro esportazione ).
File google contacts.csv struttura google.

Spero di essermi spiegato bene

Re: macro da esportazione easyfatt a google contact

Inviato: giovedì 16 giugno 2022, 16:03
da charlie
Da "Regole per principianti":
[*]Testo: ... Fate un uso corretto della grammatica italiana, della punteggiatura e delle maiuscole dopo il punto e all'inizio paragrafo...

Re: macro da esportazione easyfatt a google contact

Inviato: giovedì 16 giugno 2022, 16:31
da coguaro80
charlie ha scritto: giovedì 16 giugno 2022, 16:03 Da "Regole per principianti":
[*]Testo: ... Fate un uso corretto della grammatica italiana, della punteggiatura e delle maiuscole dopo il punto e all'inizio paragrafo...
Hai ragione :crazy: :crazy:

Chiedo scusa

Re: macro da esportazione easyfatt a google contact

Inviato: giovedì 16 giugno 2022, 16:59
da charlie
:) Grazie

Re: Macro da esportazione easyfatt a google contact

Inviato: sabato 10 settembre 2022, 12:14
da coguaro80
troppo complicato?

Re: Macro da esportazione easyfatt a google contact

Inviato: sabato 10 settembre 2022, 17:42
da patel
Ma che c'entra la macro che hai inserito nel primo post con l'argomento in oggetto ?
Inoltre hai dato per scontato che tutti conoscano easyfatt, insomma scarse spiegazioni portano a zero risposte.

Re: Macro da esportazione easyfatt a google contact

Inviato: lunedì 12 settembre 2022, 13:05
da coguaro80
patel ha scritto: sabato 10 settembre 2022, 17:42 Ma che c'entra la macro che hai inserito nel primo post con l'argomento in oggetto ?
Inoltre hai dato per scontato che tutti conoscano easyfatt, insomma scarse spiegazioni portano a zero risposte.
La macro che ho inserito serviva per convertire il file iniziale esportato da EasyFatt, che è quello che ho caricato con nome Soggetti.ods, in un file che possa piacere a Google Contact, solo che essendo cambiate le strutture dei file e purtroppo non avendo la macro commentata mi è difficile modificarla da solo.
Non do per scontato che tutti conoscano EasyFatt, tecnicamente per quello che chiedo non ce ne è neanche bisogno, l'ho menzionato per far comprendere che il file che ho come principale esce da quel programma e ha quella struttura, come non do per scontato che tutti conoscano e usino l'importazione di Google Contac, per questo ho messo i file di esempio che alcuni hanno anche scaricato, posso essere stato troppo sintetico nel primo post, però considerando le strutture e i dati dei due file pensavo che fosse sottointeso in che modo doveva essere convertito il primo file ( errore mio ).
Ho anche concluso con
coguaro80 ha scritto: giovedì 16 giugno 2022, 15:39 Spero di essermi spiegato bene
Se qualcuno eventualmente non aveva capito la mia richiesta e voleva realmente aiutarmi poteva chiedere delucidazioni maggiori.

Re: Macro da esportazione easyfatt a google contact

Inviato: lunedì 12 settembre 2022, 17:49
da patel
Se ho capito bene dal file soggetti occorre ricavare google contacts.csv, ma il csv che hai allegato contiene soltanto l'intestazione, dovresti allegarne uno con i dati di soggetti scritti manualmente.

Re: Macro da esportazione easyfatt a google contact

Inviato: lunedì 12 settembre 2022, 18:42
da coguaro80
il file "google contacts.csv" è la traccia che da google per creare il file da importare invece il file "contacts (1).csv" contiene un esempio di dati esportati già da Google Contact

Re: Macro da esportazione easyfatt a google contact

Inviato: martedì 13 settembre 2022, 12:34
da patel
I lavoro non è difficile, ma è una gran rottura di ..... , troppi dati da mettere al posto giusto, se tu riesci a scrivere la prima riga di dati correttamente (non l'intestazione) poi ti aiuto a scrivere le altre righe.

Re: Macro da esportazione easyfatt a google contact

Inviato: martedì 13 settembre 2022, 15:17
da coguaro80
patel ha scritto: martedì 13 settembre 2022, 12:34 I lavoro non è difficile, ma è una gran rottura di ..... , troppi dati da mettere al posto giusto, se tu riesci a scrivere la prima riga di dati correttamente (non l'intestazione) poi ti aiuto a scrivere le altre righe.
Ma vuoi un file con i dati già al posto giusto?
Oppure vuoi la macro "corretta" per quello che riesco a comprendere io?

Re: Macro da esportazione easyfatt a google contact

Inviato: martedì 13 settembre 2022, 15:44
da Gaetanopr
coguaro80 ha scritto: giovedì 16 giugno 2022, 15:39 Ho questa vecchia macro:

Codice: Seleziona tutto

Sub Google
Sh1 = ThisComponent.Sheets(0)' foglio 1
Sh2 = ThisComponent.Sheets(1)' foglio 2
c = Sh1.createCursor
c.gotoEndOfUsedArea(false)
LR = c.RangeAddress.EndRow + 1
for arow = 2 to LR
  if Sh1.GetCellRangebyName("K" & arow ).string <> "" then
     Sh2.GetCellRangebyName("A" & arow ).string = Sh1.GetCellRangebyName("A" & arow ).string & " " & Sh1.GetCellRangebyName("D" & arow ).string 
     Sh2.GetCellRangebyName("B" & arow ).string = Sh1.GetCellRangebyName("D" & arow ).string 
     Sh2.GetCellRangebyName("I" & arow ).string = Sh1.GetCellRangebyName("A" & arow ).string 
     Sh2.GetCellRangebyName("AC" & arow ).string = "* My Contacts" 
     Sh2.GetCellRangebyName("AB" & arow ).string = "* Home"  
     Sh2.GetCellRangebyName("AE" & arow ).string = Sh1.GetCellRangebyName("Q" & arow ).string 
     Sh2.GetCellRangebyName("AJ" & arow ).string = "Mobile" 
     Sh2.GetCellRangebyName("AE" & arow ).string = "+39" & Sh1.GetCellRangebyName("O" & arow ).string 
     Sh2.GetCellRangebyName("AL" & arow ).string = "* Home"
     Sh2.GetCellRangebyName("AM" & arow ).string = Sh1.GetCellRangebyName("E" & arow ).string & " " & Sh1.GetCellRangebyName("F" & arow ).string & " " & Sh1.GetCellRangebyName("G" & arow ).string & ", " & Sh1.GetCellRangebyName("H" & arow ).string 
     Sh2.GetCellRangebyName("AN" & arow ).string = Sh1.GetCellRangebyName("E" & arow ).string
     Sh2.GetCellRangebyName("AO" & arow ).string = Sh1.GetCellRangebyName("F" & arow ).string
     Sh2.GetCellRangebyName("AQ" & arow ).string = Sh1.GetCellRangebyName("G" & arow ).string & " " & Sh1.GetCellRangebyName("H" & arow ).string 
     Sh2.GetCellRangebyName("AL" & arow ).string = Sh1.GetCellRangebyName("D" & arow ).string
     Sh2.GetCellRangebyName("AM" & arow ).string = Sh1.GetCellRangebyName("H" & arow ).string
     if Len(Sh2.GetCellRangebyName("AG" & arow ).string) = 4 Then Sh2.GetCellRangebyName("AG" & arow ).string = ""
  end if 
next

   MSGBOX "Fine"

End Sub

Non fatta da me che ho provato a ricollegare essendo sia la struttura di esportazione di easyfatt che quella del file di google cambiate.
Purtroppo ho diversi problemi:

Il primo è che mi fà solo la prima riga dopo l'intestazione senza dare errori e non va avanti.
Il secondo non essendo commentata ho problemi a riconoscere le varie colonne.
coguaro80 ha scritto: lunedì 12 settembre 2022, 13:05 La macro che ho inserito serviva per convertire il file iniziale esportato da EasyFatt, che è quello che ho caricato con nome Soggetti.ods, in un file che possa piacere a Google Contact, solo che essendo cambiate le strutture dei file e purtroppo non avendo la macro commentata mi è difficile modificarla da solo.
Innanzitutto sarebbe utile non fondamentale che linkassi la discussione iniziale o il post da dove hai preso la macro.
La macro da te allegata presume l'esistenza di due fogli invece nell'esempio ne è presente solo uno quindi qualcosa non torna, poi continui a dire che la macro non è commentata quindi non riesci a modificarla, la macro è abbastanza semplice da interpretare chi l'ha scritta ha usato il nome delle colonne
al posto del numero degli indici(quindi ancora più semplice), la macro fa una semplice copia da foglio1 a foglio2, verifica la presenza di dati ad ogni riga iniziando dalla terza

Codice: Seleziona tutto

if Sh1.GetCellRangebyName("K" & arow ).string <> "" then
questo codice invece concatena i dati di colonna A e colonna D del foglio1 aggiungendo uno spazio tra di loro e li riporta sulla colonna A del foglio2.

Codice: Seleziona tutto

Sh2.GetCellRangebyName("A" & arow ).string = Sh1.GetCellRangebyName("A" & arow ).string & " " & Sh1.GetCellRangebyName("D" & arow ).string
questa altra parte invece

Codice: Seleziona tutto

Sh2.GetCellRangebyName("AC" & arow ).string = "* My Contacts" 
scrive su ogni riga * My Contacts e così via per il resto.

Re: Macro da esportazione easyfatt a google contact

Inviato: martedì 13 settembre 2022, 16:14
da coguaro80
Gaetanopr ha scritto: martedì 13 settembre 2022, 15:44
coguaro80 ha scritto: giovedì 16 giugno 2022, 15:39 Ho questa vecchia macro:

Codice: Seleziona tutto

Sub Google
Sh1 = ThisComponent.Sheets(0)' foglio 1
Sh2 = ThisComponent.Sheets(1)' foglio 2
c = Sh1.createCursor
c.gotoEndOfUsedArea(false)
LR = c.RangeAddress.EndRow + 1
for arow = 2 to LR
  if Sh1.GetCellRangebyName("K" & arow ).string <> "" then
     Sh2.GetCellRangebyName("A" & arow ).string = Sh1.GetCellRangebyName("A" & arow ).string & " " & Sh1.GetCellRangebyName("D" & arow ).string 
     Sh2.GetCellRangebyName("B" & arow ).string = Sh1.GetCellRangebyName("D" & arow ).string 
     Sh2.GetCellRangebyName("I" & arow ).string = Sh1.GetCellRangebyName("A" & arow ).string 
     Sh2.GetCellRangebyName("AC" & arow ).string = "* My Contacts" 
     Sh2.GetCellRangebyName("AB" & arow ).string = "* Home"  
     Sh2.GetCellRangebyName("AE" & arow ).string = Sh1.GetCellRangebyName("Q" & arow ).string 
     Sh2.GetCellRangebyName("AJ" & arow ).string = "Mobile" 
     Sh2.GetCellRangebyName("AE" & arow ).string = "+39" & Sh1.GetCellRangebyName("O" & arow ).string 
     Sh2.GetCellRangebyName("AL" & arow ).string = "* Home"
     Sh2.GetCellRangebyName("AM" & arow ).string = Sh1.GetCellRangebyName("E" & arow ).string & " " & Sh1.GetCellRangebyName("F" & arow ).string & " " & Sh1.GetCellRangebyName("G" & arow ).string & ", " & Sh1.GetCellRangebyName("H" & arow ).string 
     Sh2.GetCellRangebyName("AN" & arow ).string = Sh1.GetCellRangebyName("E" & arow ).string
     Sh2.GetCellRangebyName("AO" & arow ).string = Sh1.GetCellRangebyName("F" & arow ).string
     Sh2.GetCellRangebyName("AQ" & arow ).string = Sh1.GetCellRangebyName("G" & arow ).string & " " & Sh1.GetCellRangebyName("H" & arow ).string 
     Sh2.GetCellRangebyName("AL" & arow ).string = Sh1.GetCellRangebyName("D" & arow ).string
     Sh2.GetCellRangebyName("AM" & arow ).string = Sh1.GetCellRangebyName("H" & arow ).string
     if Len(Sh2.GetCellRangebyName("AG" & arow ).string) = 4 Then Sh2.GetCellRangebyName("AG" & arow ).string = ""
  end if 
next

   MSGBOX "Fine"

End Sub

Non fatta da me che ho provato a ricollegare essendo sia la struttura di esportazione di easyfatt che quella del file di google cambiate.
Purtroppo ho diversi problemi:

Il primo è che mi fà solo la prima riga dopo l'intestazione senza dare errori e non va avanti.
Il secondo non essendo commentata ho problemi a riconoscere le varie colonne.
coguaro80 ha scritto: lunedì 12 settembre 2022, 13:05 La macro che ho inserito serviva per convertire il file iniziale esportato da EasyFatt, che è quello che ho caricato con nome Soggetti.ods, in un file che possa piacere a Google Contact, solo che essendo cambiate le strutture dei file e purtroppo non avendo la macro commentata mi è difficile modificarla da solo.
Innanzitutto sarebbe utile non fondamentale che linkassi la discussione iniziale o il post da dove hai preso la macro.
La macro da te allegata presume l'esistenza di due fogli invece nell'esempio ne è presente solo uno quindi qualcosa non torna, poi continui a dire che la macro non è commentata quindi non riesci a modificarla, la macro è abbastanza semplice da interpretare chi l'ha scritta ha usato il nome delle colonne
al posto del numero degli indici, la macro fa una semplice copia da foglio 1 a foglio2, quindi verifica la presenza di dati ad ogni riga iniziando dalla terza

Codice: Seleziona tutto

if Sh1.GetCellRangebyName("K" & arow ).string <> "" then
questo codice invece concatena i dati di colonna A e colonna D del foglio1 e li riporta su colonna A del foglio2.

Codice: Seleziona tutto

Sh2.GetCellRangebyName("A" & arow ).string = Sh1.GetCellRangebyName("A" & arow ).string & " " & Sh1.GetCellRangebyName("D" & arow ).string
questa altra parte invece

Codice: Seleziona tutto

 Sh2.GetCellRangebyName("AC" & arow ).string = "* My Contacts" 
scrive su ogni riga * My Contacts e così via per il resto.
Purtroppo non sono riuscito a ritrovare la discussione iniziale nella quale mi avevano dato quella macro( non ricordo neanche se era su questo forum o un altro essendo abbastanza vecchia parlo di qualche anno)

Per quanto riguarda il fatto che il file ha un solo foglio invece di due potrebbe essere sempre dovuto a qualche modifica nel come esporta il file il programma? Non ci avevo fatto caso.

La macro in sé può anche essere semplice, ma purtroppo essendo cambiate le strutture di tutti e due i file per me è complicato riuscire a capire come ricollegare le singole righe della macro a quale gruppo fanno capo, come quella che hai portato di esempio, purtroppo non ho un vecchio file con le vecchie strutture per risalire a cose era la colonna A B C ecc..., se avessi ritrovato la discussione originale con i relativi file magari riuscivo a commentarmi da solo la macro e poi capire come sono cambiate le strutture e di conseguenza ricollegarle e modificare i richiami alle colonne corrette

Delle altre macro che avevo sono riuscito a fare qualche piccola modifica visti i cambi di struttura nei file che usavo, però per questa non ci riesco forse è cambiata troppo la struttura o qualcos'altro che mi sfugge, visto che anche se i dati nelle colonne non sono gli stessi la macro dovrebbe funzionare lo stesso ma fa una solo riga?

Forse sono io che mi perdo in un bicchiere d'acqua :crazy: :crazy: :crazy: :crazy:

Re: Macro da esportazione easyfatt a google contact

Inviato: martedì 13 settembre 2022, 16:27
da Gaetanopr
coguaro80 ha scritto: martedì 13 settembre 2022, 16:14 Delle altre macro che avevo sono riuscito a fare qualche piccola modifica visti i cambi di struttura nei file che usavo, però per questa non ci riesco forse è cambiata troppo la struttura o qualcos'altro che mi sfugge, visto che anche se i dati nelle colonne non sono gli stessi la macro dovrebbe funzionare lo stesso ma fa una solo riga?
Fa soltanto una riga molto probabilmente perché alla colonna K non trova nulla nella nuova struttura quindi

Codice: Seleziona tutto

if Sh1.GetCellRangebyName("K" & arow ).string <> "" then
non supera questo controllo e non scrive nulla, prova a togliere questa la riga e end if finale e vedi cosa succede.

Re: Macro da esportazione easyfatt a google contact

Inviato: martedì 13 settembre 2022, 17:46
da patel
coguaro80 ha scritto: martedì 13 settembre 2022, 15:17 Ma vuoi un file con i dati già al posto giusto?
Oppure vuoi la macro "corretta" per quello che riesco a comprendere io?
Vorrei la macro che scrive almeno la prima riga correttamente.