0

I should format some data in an excel sheet as an excel table using powershell (manually it means selecting a range on a sheet and click on "format as a table"). Probably I need to use COM, but I don't know the syntax for a similar command. Is there anybody who has a script to take as an example or the link to a good COM guide where I could find something helpful? Thank you.

Gufus
  • 418
  • 2
  • 7
  • 15
  • 1
    Have a look [here](https://stackoverflow.com/a/68642193/9898643). That uses a CSV file as input, but it shows how easy it can be using module [ImportExcel](https://github.com/dfinke/ImportExcel) and also explains how to do it using Excel as COM object. – Theo Oct 23 '21 at 13:59

1 Answers1

1

I know the question is 2 months old, but this is the line I use to convert my data to a table:

Export-Excel -Path "Path\To\Excel.xlsx" -TableName CreateYourTableNameHere -AutoSize
Ronnie
  • 852
  • 12
  • 25
Josh
  • 43
  • 7