Windows: January 2014 Archives

CSV Tips for Excel

user-pic
Vote 0 Votes

輸出 UTF-8 格式 CSV, 讓 Excel 能正常讀取, 需加 BOM 檔頭
PHP: echo "\xEF\xBB\xBF"
BASH: echo -n $'\xEF\xBB\xBF'
這種方式只有 Excel 2007 會亂碼, 應該是 Exel 2007 本身的問題, 需用這種方式開啟

有換行的資料用 "" 包起來
例:
ABC,"123
456
789"

第一碼為 0 的一串數字, 讓 0 正常顯示
="0123",="0456"

資料中間有 ", 需用 "" 包起來, 兩個 "" 代表一個 ", 若 " 在文字中間, 可以不用包起來, 一個 " 代表一個 "
例:
"""","ABC""123",ABC"123

可以使用 Excel 函式及儲存格代碼
例:
1.61803398,=INT(A1),"=ROUND(A1,2)"

Recent Entries

About this Archive

This page is an archive of entries in the Windows category from January 2014.

Windows: November 2013 is the previous archive.

Windows: July 2014 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives