您的csv和xls数据相同吗?
为什么不直接用Excel、edit或formulas等打开csv。。
然后另存为xls?
汇总可以在列表中完成:
示例:根据您的数据。
例子:
;将列表拆分为行
(setq行
(mapcar“”((x)(csv$x))数据)
;将列表转换为列
(setq列(trp行))
;每列(A、B、C)的总和
(_sum列)
;(5599.0 88.0 7960.0)
;每排集水坑(1~7)
(_总和行)
;(13.0 13.0 7545.0 5465.0 53.0 55.0 503.0)
子功能
- ;transpose : Doug Wilson
- (defun trp (x)
- (apply 'mapcar (cons 'list x)))
- (defun csv$ (str / i l) ;split csv
- (while (setq i (vl-string-search "," str))
- (setq l (cons (substr str 1 i) l)
- str (substr str (+ 2 i) (- (strlen str) i))
- ) ;_ end of setq
- ) ;_ end of while
- (reverse(vl-remove "" (cons str l)))
- )
- (defun _sum (lst)
- (mapcar ''((x)(apply '+ (mapcar 'atof x))) lst))
|