powershell - Extra rows in a XLSX export via SQL Pull -


Sorry, if I am saying anything which is very basic, but last night I started a power shake and I feel for it.

New language

I am using the export given to the XLSX script provided by the link given below:

I am also using a simple SQL Server dragging (SQL_Connection_Script.ps1):

$ data source = "####" $ user = "####" $ pwd = "####" $ database = "# ### "$ ConnectionString =" server = $ data source; uid = $ user; pwd = $ pwd; database = $ database; integrated protection = false; select from name "$ Query =" where id = '1000' " $ Connection = new object instance In. Data SQLLient.SqlConnection $ connection.ConnectionString = $ connectionString $ connection.Open () $ command = $ connection.CreateCommand () $ Command.CommandText = $ query $ result = $ command.ExecuteReader () $ table = new-object "System. Data.DataTable "$ table.Load ($ Result) $ table $ connection.Close ()

My problem is that when I export this object, I get additional columns Are: Roederotter, Rostate, Table, Maidair and Heisarers.

Is there no way to remove these columns from any command? Should I unknow a dynamic selection statement, ignore the example below or include me?

I hope that if possible, do not use dynamic selection statements.

 . Desktop \ SQL_Connection_Script.ps1 | Choose $ Dynamic Headers. Export-xlsx-path Desktop \ Testing 123.xlsx -Append  

So it seems that my SQL Server pull function is something that is pulling in extra fields. Any ideas?

After looking for a while, I found out that I can exclude properties.

 . Desktop \ SQL_Connection_Script.ps1 | Choose * - Property Property Roarrer, Roastate, Hesaras, Table, MadArere | Export-XLSX-Path \ Desktop \ test123.xlsx -Append  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -