I am using powershell to copy data from CSV to an excel worksheet (In a existing spreadsheet). I have a pivot table in another worksheet that references the data that I am copying from the CSV. The only problem is, the numeric values in CSV files are getting converted to text in Excel which is throwing the calculated fields in the pivot table haywire.
The fields in the spreadsheet are defined as numeric (I've made sure of that)
The values in the CSV file are being exported from a SQL Query and are enclosed with quotes. I removed the quotes before loading it into the excel sheet and it makes no difference. What started out as a one time task ended up being used multiple times and I want to automate this.
Any suggestions here would be very helpful
The flow here is
- Powershell script kicks off a SQL Script and copies output to a CSV file which contains 4 columns with numeric data
- Data in the CSV file is copied to a worksheet in an existing spreadsheet with 2 worksheets
- The 2nd worksheet contains a pivot table which references data in the first worksheet.
numberformat
for the cells. – restless1987