1 Replies - 2927 Views - Last Post: 29 September 2017 - 05:24 PM

#1 hexagod  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 242
  • Joined: 29-October 16

Pulling Data from .XLSX File?

Posted 29 September 2017 - 12:56 PM

Happy firriday to all you working coder playboys and girls!

So at my work I have created an .xlsx file which contains every printer that I install or have verified to be working. I have created a system using VC++ which generates a powershell script and then automatically runs it to install printers. The next phase of my project involves a synthesis of the two. I would now like to take the printer DB (.xlsx file) and use the values within the DB to install printers. So essentially it will pull data from the .xlsx file and autofill my textBoxes. I could probably do it all behind the scenes but I would like to have it put the data into the textBoxes and run the same as if the user put in the data. Do you guys have any idea how to do this?

I remember awhile back someone mentioned that I could use an ODBC to do this? Does anyone have any good resources or ideas for what I should search for?

Is This A Good Question/Topic? 0
  • +

Replies To: Pulling Data from .XLSX File?

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 5923
  • View blog
  • Posts: 20,251
  • Joined: 05-May 12

Re: Pulling Data from .XLSX File?

Posted 29 September 2017 - 05:24 PM

Your approach/design is broken. Why go through the intermediate step of filling in textboxes to generate the powershell script, and then (as you mentioned in your other thread) to click another button to run the script? The correct approach/design is simply read the data f on the spreadsheet, and then run everything as pure C++/CLI code. Or better yet, C# code. If there is too many "goodies" in the powershell that simplify some things, then generate the powershell script in memory and host the powershell engine instead of shelling out to execute the script. I believe that I have also advised you to do this before as well.

I have seen nothing in your past threads yet where the use of C++/CLI was actually needed to simplify anything. The places where you could have had some gains by calling the Win32 API directly, you do not do so. Instead you either do the operation in Powershell or use the managed API.

As scary as it may seem of starting from scratch and switching to C# it will actually accelerate your progress, learning, and give you access to more resources.

The nice thing about C++/CLI is that you can call it from C# so that you technically do not have to be start from scratch. You could convert piecemeal if you wanted to. If you had a good design, I would be recommend this all approach, but alas, you seem to be putting together a Rube Goldberg contraption.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1