为什么XLS在从PHP导出时需要“ID#”作为第一列标题?

I wrote a utility to export a report from database to xls file. The database had some utf-8 characters which were not being converted into unreadable text when i wrote it to excel. I found a strange solution that if i post the first column first cell as specifically "ID#", it writes perfectly. Rest whatever i do with other columns, doesnt matter. BUT if i put anything else other than ID#, it prints unreadable rows.

For example when I put up ID# in first cell of first row, this is what i get

enter image description here

which is perfect.

But if i put anything else in the first cell, this is what happens.

enter image description here

Here is the code.

function generate_excel_report($filename, $header_array, $column_names, $data, $attachment_column, $correct_answer_column = FALSE, $insert_correct_answer = False) {
   header("Content-Disposition: attachment; filename=\"$filename\"");
    header("Content-Type: application/vnd.ms-excel;charset=UTF-8");
    iconv_set_encoding("internal_encoding", "UTF-8");
    iconv_set_encoding("output_encoding", "ISO-8859-1");

    for ($i = 0; $i < count($header_array); $i++) {
        echo $header_array[$i] . "\t";
    }
    echo "
";
    $j = 0;
    foreach ($data as $row) {
        $k = 0;
        for ($i = 0; $i < count($header_array); $i++) {
            if ($i == $attachment_column) {
                if ($row['attachment_type'] != '') {
                    echo '"' . $row['attachment_url'] . '"' . "\t";
                } else {
                    echo '"' . $row[$column_names[$k]] . '"' . "\t";
                    $k++;
                }
            } else if ($i == $correct_answer_column && $insert_correct_answer) {
                echo '"' . $row['option_' . $row['correct_answer']] . '"' . "\t";
            } else {
                if ($i == 0) {
                    echo '"' . ++$j . '"' . "\t";
                } else {
                    echo '"' . $row[$column_names[$k]] . '"' . "\t";
                    $k++;
                }
            }
        }
        echo "
";
    }
}

I have absolutely no idea why it is doing so...Anyone can help here?

Thanks

This is because Excel thinks that Text files starting with IDxxx are in SYLK Format. See e.g. here You can with Id oder 'ID (with apostrophe) but not ID.