3 Replies - 3938 Views - Last Post: 16 January 2018 - 04:52 PM

#1 hexagod   User is offline

  • D.I.C Regular

Reputation: 5
  • View blog
  • Posts: 265
  • 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   User is offline

  • Code herder
  • member icon

Reputation: 6216
  • View blog
  • Posts: 21,453
  • 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? 1
  • +
  • -

#3 hexagod   User is offline

  • D.I.C Regular

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

Re: Pulling Data from .XLSX File?

Posted 16 January 2018 - 10:42 AM

I think you're under the assumption that I know what I'm doing or that I am a intelligent individual... I wouldn't go as far as to say that either one of those == true ...

I write my code in between calls at an IT helpdesk; so It's not like I've got all day to sit and figure out how all this works within the OS. I already know how to use PowerShell, C++, .NET, and I know how to output scripts then run them. yes. --I know that this is not efficient-- but regardless, my program has saved me hours upon hours of time that I would have had to divert to mind numbing tasks like moving files and installing printers.

I think the answer to my question lies in creating an ODBC object within VC++ then pulling data from it... I'm looking into that. Even more importantly, though, I need to figure out how to use loops to install on multiple computers @ once.
Was This Post Helpful? 0
  • +
  • -

#4 hexagod   User is offline

  • D.I.C Regular

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

Re: Pulling Data from .XLSX File?

Posted 16 January 2018 - 04:52 PM

View PostSkydiver, on 29 September 2017 - 05:24 PM, said:

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.


OK you convinced me, I'm going to start re-learning C#.

I think rather than starting over.. what I will do is create an ASP.NET application in C#

Thanks for the guidance!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1