**************************************** * Help with the sc Spreadsheet program * * A cross platform TUI spreadsheet * **************************************** Basic sc Usage in Command Mode ------------------------------------------ hjkl — vi keys motion (or cursor keys). gB13 — go to cell B13. ir, ic — insert row, insert column. ma (mb, mc and so on) — “mark” cell as a (or b, or c and so on). ca (cb, cc and so on) — copy contents previously marked with ma. Ctrl-f, Ctrl-b — page up or down (also pgup, pgdown). dr, yr, pr — delete row, yank row, put row. dc, yc, pc — delete column, yank, put column. dd, yd, pd — delete, yank, put a cell. = — enter a numeric value (25 or F13-D14) or formula (@sum(A2:A145)). < — insert left-justified text. \ — insert centered text. > — insert right-justified text. x — remove cell. W — write plain-text file. P — write an .sc file. G — read (“get”) an .sc file. Zr, Zc — zap (hide) row or column. sr, sc — show row or column. @ — force re-calculation. e — edit a numeric value. E — edit a string value. Exhanging info with other spreadsheet programs: ---------------------------------------------------- You also can output other formats. For instance, to output a LaTeX table to paste into a paper, type S (for set) tblstyle=latex, followed by T (for table output) output.tex. The resulting LaTeX table, of course, also lends itself to unending options for pretty-fication by adding images, fonts, colors and whatnot. For me, plain text almost always is the most useful. To exchange data with other spreadsheet programs, sc exports in a colon-delimited format. Unfortunately, this exports the results of formulas and not the formulas themselves, but it still can be useful. You can output colon-separated files in sc by typing S (for set) tblstyle=0, followed by T (for table output) output.cln. Actually, 0 is the default tblstyle, so you need to do only the first step (S), if you selected another format previously (like LaTeX). To import this in OpenOffice.org's OOCalc, open OOCalc, go to the Insert menu, and choose Select from file. Browse to your output.cln file and select it. You'll get an import screen with a Separator options section. For Separated by, choose Other, and type in a colon. Make sure all other Separated by options are deselected, or it won't work right. Unfortunately, although sc can export other formats, it does not import them. However, you can work around that. One way is to start by getting CSV output. This should be an option for your on-line bank statement, for instance. From OOCalc, choose Save as→Text CSV format, and click Edit filter setting. If the next pop-up warns you about losing information in this format, click keep current format. In the field options pop-up, unselect Save cell contents as shown; otherwise, numeric values will be placed in quotes. For field delimiter, let's use :, as that's what sc outputs. Let's assume that import.csv is the name of the resulting file. Python Script to Convert CSV Files to sc Format ------------------------------------------------------------- #!/usr/bin/python import sys import string if len(sys.argv) < 2: print "Usage: %s infile [outfile] [delimiter_char]" % sys.argv[0] sys.exit(1) filename_in = sys.argv[1] if len(sys.argv) > 2: filename_out = sys.argv[2] outfile = open(filename_out, 'w') else: outfile = sys.stdout delimiter = ':' if len(sys.argv) == 4: delimiter = sys.argv[3][0] print 'using delimiter %c' % delimiter infile = open(filename_in, 'r') letters = string.ascii_uppercase text = ["# Produced by convert_csv_to_sc.py" ] row=0 for line in infile.readlines(): allp = line.rstrip().split(delimiter) if len(allp) > 25: print "i'm too simple to handle more than 26 many columns" sys.exit(2) column = 0 for p in allp: col = letters[column] if len(p) == 0: continue try: n = string.atol(p) text.append('let %c%d = %d' % (col, row, n)) except: if p[0] == '"': text.append('label %c%d = %s' % (col, row, p)) else: text.append('label %c%d = "%s"' % (col, row, p)) column += 1 row += 1 infile.close() outfile.write("\n".join(text)) outfile.write("\n") if outfile != sys.stdout: outfile.close() --------------------------------------------------- https://www.linuxjournal.com/article/10699