Question: I am running a Linux server and one of our suppliers only knows how to send me an Excel file which I need to import into our system daily. Does anyone know of a good way to export the Excel file to a delimited file? Preferably with php or perl.

Thanks!

Chris Edwards

Answer: 
Something like this if the names match, maybe?

```
 System.Data.SqlDbType otherEnumTypeValue = System.Data.SqlDbType.Xml;
 Microsoft.SqlServer.Management.Smo.SqlDataTypeconverted = 
         (Microsoft.SqlServer.Management.Smo.SqlDataType)Enum.Parse(typeof(Microsoft.SqlServer.Management.Smo.SqlDataType), otherEnumTypeValue.ToString());

```
Conversion from SqlDataType to SqlDbType using Bala R's enum parsing code plus special cases for unsupported conversions.

```
private static SqlDbType ConvertSqlTypeEnum(SqlDataType sqlDataType)
        {
            SqlDbType sqlDbType;
            switch (sqlDataType)
            {
                case SqlDataType.UserDefinedType:
                    sqlDbType = System.Data.SqlDbType.Udt;
                    break;
                case SqlDataType.None:
                case SqlDataType.NVarCharMax:
                case SqlDataType.UserDefinedDataType:
                case SqlDataType.VarBinaryMax:
                case SqlDataType.VarCharMax:
                case SqlDataType.SysName:
                case SqlDataType.Numeric:
                case SqlDataType.UserDefinedTableType:
                case SqlDataType.HierarchyId:
                case SqlDataType.Geometry:
                case SqlDataType.Geography:
                    throw new NotSupportedException("Unable to convert to SqlDbType:" + sqlDataType);
                default:
                    sqlDbType = (SqlDbType)Enum.Parse(typeof(SqlDbType), sqlDataType.ToString());
                    break;
            }
            return sqlDbType;
        }

```

The reverse should be simpler with only Udt and Structured requiring special handling.