ImportExcel reading in old information #1639
Replies: 2 comments 2 replies
-
Sounds strange. Would need simple data and scripts that repro the issue. |
Beta Was this translation helpful? Give feedback.
-
Thank you for responding! I have attached a zip file with an example of the problem. Within the zip file are the following:
The script creates student-corrected.csv and export.csv each time, so you can delete them after each run of the powershell script. To reproduce the issue, run manipulate.ps1. You'll notice it creates a perfectly formed export.csv. Delete export.csv and student-corrected.csv. Then, edit something in the student.csv file (ie, change the name of the first student). Run the powershell script again. You'll notice that the export.csv still contains the original name of the first student. However, the student-corrected.csv and both tabs of the student-completed.xlsx file are all correctly showing the updated name. In troubleshooting, I have run the import in the final command to screen instead of outputting to CSV, so I know that the data issue rears its head on the Import-Excel rather than on the Export-Csv portion of that command. I know how busy you must be, so I appreciate any time you can spend on finding where I've gone wrong. Thank you! |
Beta Was this translation helpful? Give feedback.
-
I have a project that I've been assigned where I get a CSV delivered daily to a folder. I have to manipulate the data in the CSV to match some very specific formatting and then upload the file to an SFTP server. I am able to use PowerShell to manipulate most of the data. However, there are a couple of fields that needed more than I could get Powershell to do on its own, so I used the Import-Excel module to pull the CSV into a worksheet of a Excel workbook. A separate worksheet in that workbook manipulates the data that I've imported. That all works wonderfully. However, when I use the Import-Excel module to pull the new spreadsheet into memory to be output to CSV, it only works once. When the data changes in the underlying CSV and I get to the final step to read and export the Excel spreadsheet to CSV, it reads the old values...not what is currently in the spreadsheet. It is almost as if the information is cached somewhere. If I change the name of the worksheet being exported and update the Powershell accordingly, it reads the updated values once, and then I'm in the same boat again. Any suggestions appreciated!
Beta Was this translation helpful? Give feedback.
All reactions