title: Stop Numeric converting to text in Excel when using powershell
body: <p>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. </p>
  
  <p>The fields in the spreadsheet are defined as numeric (I've made sure of that)</p>
  
  <p>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.</p>
  
  <p>Any suggestions here would be very helpful</p>
  
  <p>The flow here is</p>
  
  <ol>
  <li>Powershell script kicks off a SQL Script and copies output to a CSV file which contains 4 columns with numeric data</li>
  <li>Data in the CSV file is copied to a worksheet in an existing spreadsheet with 2 worksheets</li>
  <li>The 2nd worksheet contains a pivot table which references data in the first worksheet.</li>
  </ol>