Skip to main content

Is there a way to create an Excel formatted table with FME?

 

I can create only a named group of cells using this sintax in xls writer sheet name parameter : <sheet_name>/<group_name> as showed below

 

Thank You

@cdalessandro We haven't had any luck working with tables in Excel, yet. If you could use a named range to define the data in the table then I think it should work. Then you could use a template to define the table/named range in a similar way to Using a Template File when Writing Excel Data. Alternatively some scripting in Excel may be the approach.

Anyone with deep knowledge of Excel please chime in...


Thank You Mark,

I wrote a macro to do that. I attached it if anyone need it

 

Sub CreaTabelleInFogli()

 

 

 

 

Dim i As Integer

 

 

Dim nr As Integer

 

 

Dim sheetName As String

 

 

Dim rng1 As Range, rng2 As Range

 

 

Dim NewRng As Range

 

 

 

 

' Ciclo tutti i fogli a partire dal secondo

 

 

For i = 4 To Sheets.Count

 

 

' Attivo il foglio sul quale si effettua l'elaborazione

 

 

Sheets(i).Activate

 

 

' Ciclo tutte le righe per trovare la prima null

 

 

For nr = 1 To 4000

 

 

If ActiveSheet.Cells(nr, 1) = vbNullString Then

 

 

Exit For

 

 

End If

 

 

Next nr

 

 

' Setto i range e li seleziono

 

 

Set rng1 = ActiveSheet.Range("A1")

 

 

Set rng2 = ActiveSheet.Range("A" & nr - 1)

 

 

Set NewRng = ActiveSheet.Range(rng1.Address & ":" & rng2.Address)

 

 

NewRng.Select

 

 

' Definisco il nome della tabella

 

 

sheetName = ActiveSheet.Name

 

 

' Creo la tabella

 

 

ActiveSheet.ListObjects.Add(xlSrcRange, NewRng, , xlYes).Name = _

 

sheetName

 

 

 

 

Set rng1 = Nothing

 

 

Set rng2 = Nothing

 

 

Set NewRng = Nothing

 

 

Next i

 

 

 

 

End Sub

 


Reply