Hello,
I use AI chatbots as my personal trainer. I am a beginner. I wanted to create an excel file using power shell. I used letters for variables for ease instead of words.
e:excel, w:workbook, d:directory
but it didn’t work. I could still see the EXCEL in task manager.
I asked Gemini about it. Then he said I should close the workbook with this command $w.Close()
which also didn’t work.
Any insights, ideas, knowledge is welcome. I am gonna ask deep seek now.
… just an empty Excel file? Whatfor? What do you want to do with it?
That’s the next bad idea. I’m sorry if that’s not what you expected but I think you’re not doing yourself a favour learning PowerShell like this. I’d urgently recommend to learn the very basics of it (or any language) in a didactical structured way.
This way you learn to evaluate the output of AI tools if it’s reasonable or not.
If you need to work with Excel files you may take a look at the great module from Doug Finke ImportExcel.
Regardless of all that:
When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
Welcome to PowerShell.
I agree with @Olaf - AI is not the greatest way to learn a new coding language. If you take the time to learn the foundational things of PowerShell, it will serve you well as a starting point to do increasingly complex things.
I highly recommend Learn PowerShell in a Month of Lunches as a solid starting point for PowerShell.
It also really helps us help you to know what your ultimate goal is. There can be multiple ways to do something in PowerShell, and the end goal can help determine the best or simplest route to get there.