1 Reply Latest reply on Dec 14, 2006 11:51 AM by gr8white

    Renaming Column names in Excel with Coldfusion

    asdren_one Level 1
      a client has an excel sheet that gets sent to them
      I already have it working where they can upload the excel file and it will import to their SQLServer

      however the files comes with a dozen or so 'database unfriendly' column names, mostly space
      ex: First Name

      Is there a way with Coldfusion to read the Excel file and rename the Column names?
      that way I could just import that file and they don't have to rename the column names manually.

      thanks in advance,
        • 1. Re: Renaming Column names in Excel with Coldfusion
          1. SQLServer will let you use the names w/ spaces if you enclose them in double quotes, e.g. "First Name".

          2. How are you getting the data from the Excel file into SQLServer? If you are using, for example, a CREATE TABLE query you can use the Replace() function to replace spaces in the column name w/ underscores or eliminate them altogether.

          3. How are you reading the Excel file? You might want to consider using cfx_ExcelQuery which would just name the columns according to the Excel column, such as A, B, etc.