Microsoft Excel

From LemonWiki共筆
Jump to navigation Jump to search

Export MySQL query to Excel file

EXCEL limit:

  • (1) "Total number of characters that a cell can contain: 32,767 characters" Using MySQL SUBSTRING() function ex: SUBSTRING(string_column, 1, 32767) for EXCEL 97[1]-2007[2] (XLS 檔) unverified
  • (2) "Worksheet size: 1,048,576 rows": Using LIMIT for EXCEL 2007

相關文章

Export CSV from EXCEL

建議使用 LibreOffice Calc (LibreOffice Portable) 開啟 Excel 檔案,匯出 UTF-8 編碼的 CSV 檔案

  • 雖然 Excel 本身也有提供匯出 「Unicode 文字 (*.txt)」,但是因為無法設定使用雙引號框住欄位值。會造成後續匯入檔案容易出問題。
  • Excel 本身提供匯出「CSV (逗號分隔) (*.csv)」是 Big5/ANSI 編碼,遇到 Unicode 文字會變成問號。

Import CSV to EXCEL

Batch convert TXT/CSV to EXCEL

原始檔案: 欄位值用雙引號框起來(enclosure)、不同欄位資料用定位鍵 Tab 間隔、檔案編碼 UTF8 沒有 BOM

"column_1" \t "column_2" \t "column_3"

批次轉檔的方案比較

  1. Good.gif $ Advanced CSV Converter v 5.55 ok
    • 轉檔時可以選擇 UTF-8 編碼,輸出的中文 Excel 不會亂碼。
    • 但是不能辨識欄位值前後的雙引號 符號,所以原始檔案需要先去除欄位值前後的雙引號 符號。
    • 試用版只能匯出 50 筆資料。
  2. ConvertXLS v. 8.54 中文亂碼 Icon_exclaim.gif
  3. Bytescout Spreadsheet Tools v. 1.10.0.21 中文亂碼 Icon_exclaim.gif

Copy & Paste

線上編輯上面表格

  • Microsoft Excel --> Google Spreadsheet:
    • columns & rows: Copy & Paste is ok
  • Plain text --> Google Spreadsheet: ok
    • columns: Tab separated columns --> Google Spreadsheet: ok
    • rows: Enter separated rows --> Google Spreadsheet: ok
  • Plain text --> Microsoft Excel: ok
    • columns: Tab separated columns --> Microsoft Excel: ok
    • rows: Enter separated rows --> Microsoft Excel: ok
  • Microsoft Excel --> Table of Google Document:
    • columns & rows: Copy & Paste is ok
  • Plain text --> Table of Google Document: fail Icon_exclaim.gif Suggest you copy to Microsoft Excel first and then copy paste to Google Document from Microsoft Excel.
    • columns: Tab separated columns --> Table of Google Document: fail
    • rows: Enter separated rows --> Table of Google Document: fail
  • Plain text --> Microsoft Excel: ok
    • columns: Tab separated columns --> Microsoft Excel: ok
    • rows: Enter separated rows --> Microsoft Excel: ok
  • How-to Create and Copy a Table in Google Mail (Gmail) from Excel - YouTube

Google spreadsheet

利用Google spreadsheet的函式,分析及統計可複選的問卷題目結果。


Excel 「樞紐分析表(Pivot Tables)」

區塊「Σ 值」的「計數 - 欄位名稱」(該欄位的項目個數),除非是沒有填入任何資料的「空值」,否則都會被計算加 1。包含

  • 邏輯值 TRUEFALSE、字串、數值、錯誤代碼 #NAME? 等資料,會被列入計算加 1
  • IF 回傳的空值,也會被列入計算加 1 Icon_exclaim.gif version: Excel 2013

Excel 儲存格格式轉換

  • 通用格式的年份,改成時間格式的年份:
    • 法1: 將 2010 改成 2010/01/01 ,再利用 YEAR 函數擷取出年份
    • 法2: 將 2010 改成 2010/01/01 ,再利用 Tableau$ 轉換成年份 Icon_exclaim.gif walk around approach!

Excel 效能議題

個人經驗

  • 資料筆數大量時的替代方案
    • 如果 Excel 資料筆數約百萬筆,操作速度約耗費數小時,可改用資料庫。資料庫資料處理後,再輸出成 Excel 檔,而不要在 Excel 檔上面進行資料處理或換算。
    • 如果要刪除符合特定條件約一萬筆的資料列太慢時。改成將篩選出符合另一條件的資料列,複製貼上到新的工作表,會比較快。
  • 降低資料處理複雜度
    • 全選工作表儲存格資料,複製後,選擇性貼上值到空白工作表。因為移除公式,所以另一工作表的操作速度會加快。 Icon_exclaim.gif 需要注意時間格式的數值會跑掉,變成一長串數字,需要額外設定儲存格格式成時間格式。
    • 多重篩選條件會使用比較多的系統資源,在不使用篩選條件下,改成使用函數處理,會比較快。

不同試算表方案的工作表或儲存格的大小限制

  • Good.gif EXCEL 2007, EXCEL 2013:
    • (約100萬列) 1,048,576 列 * 16,384 欄 = 17,179,869,184 個儲存格[3][4]
  • LibreOffice(LibreOffice Portable) Calc 3.3.3版以後 (目前版本 4.3):
    • (約100萬列) 1,048,576 列 * 1,024 欄 = 1,073,741,824 個儲存格[5][6] Icon_exclaim.gif When I save the CSV as XLS format, I met the 65,536 rows limit & 256 column limit on linux LibreOffice 3.4.5 Linux   /v. 4.2.3.3 Win  
  • Apache OpenOffice 3.x Calc:
    • (約60萬列) 65,536 列 * 1,024 欄 = 67,108,864 個儲存格[7]
  • EXCEL 2003: 工作表大小
    • (約60萬列) 65,536 列 * 256 欄 = 16,777,216 個儲存格[8]
  • Google spreadsheet:
    • 約 1000列。 所有工作表共 40 萬個儲存格。如果只使用一個工作表,使用256 欄,則列數限制為 1,562 列[9]
  • Office 365: 資料模型的規格與限制 - Excel - Office.com 適用: Excel 2013, Power BI for Office 365 Preview, Power Pivot in Excel 2013


Merge data from different files

Merge multiple CSV / Text files by using Windows command (命令提示字元)[10]

  • copy *.csv bundle.csv for different CSV files
  • copy *.txt bundle.txt for different Text files

Merge Excel worksheets (copy data from multiple worksheets into one workbook)

相關新聞聯播

Failed to load RSS feed from http://news.google.com/news?hl=zh-TW&client=firefox-a&rlz=1R1GGGL_zh-TW___TW321&q=excel+OR+spreadsheet+OR+資料科學&um=1&ie=UTF-8&output=rss: Error parsing XML for RSS


references