Revision | 0746f8606531d826d2f292018cdb460922f2948c (tree) |
---|---|
Zeit | 2022-03-31 20:27:07 |
Autor | Lorenzo Isella <lorenzo.isella@gmai...> |
Commiter | Lorenzo Isella |
A script to batch convert excel files to csv.
@@ -0,0 +1,46 @@ | ||
1 | +#!/bin/bash | |
2 | + | |
3 | +# #convert pdf to png | |
4 | + | |
5 | +# FILES="*.pdf" | |
6 | + | |
7 | +# for F in $FILES | |
8 | + | |
9 | +# do | |
10 | +# newname=`basename "$F".pdf` | |
11 | +# echo $newname | |
12 | +# pdftoppm "$F" -rx 300 -ry 300 "$newname.png" | |
13 | + | |
14 | +# done | |
15 | + | |
16 | + | |
17 | + | |
18 | +FILES="*.xlsx" | |
19 | + | |
20 | +for F in $FILES | |
21 | + | |
22 | +do | |
23 | +# See https://stackoverflow.com/questions/2664740/extract-file-basename-without-path-and-extension-in-bash/26753382#26753382 | |
24 | + | |
25 | +fbname=$(basename "$F" | cut -d. -f1) | |
26 | + | |
27 | +newname=`basename "$F"` | |
28 | +echo $newname | |
29 | +echo $fbname | |
30 | + | |
31 | +# pdftoppm "$F" -rx 300 -ry 300 "$newname.png" | |
32 | +xlsx2csv "$F" "$fbname.csv" | |
33 | +done | |
34 | + | |
35 | + | |
36 | + | |
37 | +# FILES="*.xlsb" | |
38 | + | |
39 | +# for F in $FILES | |
40 | + | |
41 | +# do | |
42 | +# newname=`basename "$F"` | |
43 | +# echo $newname | |
44 | +# # pdftoppm "$F" -rx 300 -ry 300 "$newname.png" | |
45 | +# soffice --convert-to csv --outdir text_conversion/ $newname | |
46 | +# done |