Export Multiple Gridviews to Excel

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 2 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
SvanGool
Posts: 37
Last visit: Mon Nov 27, 2023 2:02 am

Export Multiple Gridviews to Excel

Post by SvanGool »

Hello,

I've got a form with multiple gridviews. I would like to export them to Excel.
I've searched the forum and came up with this:
  1.     $datagridviewResultsAD.Rows  |
  2.     select -expand DataBoundItem |
  3.     export-csv c:\temp\test.csv -NoType
I tried to add the second one using -Append, but this is not working because the 2 datagrids are different (have different Columns. Is there a way to solve this?

Thanks.
Sander
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Export Multiple Gridviews to Excel

Post by jvierra »

No. CSV files must have the same structure to append. Use different files.
This topic is 6 years and 2 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked