Repository: saulpw/visidata

Issue:
Impossible to set current column for selected rows to incremental values and to bulk save all sheets
**Small description**

Hi, I want to open and bulk save all the html tables I have [here](https://lab24.ilsole24ore.com/ecosistema-urbano/indexT.php). All the tables have the same name, then I need to rename them using `g+i`, and then save them in bulk `g+CTRL+s`.

When I run `g+i` I have `NameError: name 'setitem' is not defined`.

If I change the name of the tables, in the saved HTML files, when I run `g+CTRL+s`, I have `AttributeError: 'str' object has no attribute 'name'`

I start from 

```
 vd https://lab24.ilsole24ore.com/ecosistema-urbano/indexT.php --save-filetype=csv
```

**Expected result**

- to have the tables renamed;
- to be able to save the tables in multiple CSV files:

**Actual result with screenshot**
![image](https://user-images.githubusercontent.com/30607/160170624-208928a1-4e53-435f-bb63-77301335c5f3.png)

![image](https://user-images.githubusercontent.com/30607/160170720-c2696239-4cac-46dc-8dc0-f8aaa322fd5f.png)

![image](https://user-images.githubusercontent.com/30607/160170830-f81ef65c-3ac1-4e94-87b1-fb2204c5e685.png)

![image](https://user-images.githubusercontent.com/30607/160170866-f5c41e67-99f1-46f0-b920-e271251f9c4a.png)


**Steps to reproduce with sample data and a .vd**
Please attach the commandlog (saved with `Ctrl-D`) to show the steps that led to the issue.
See [here](http://visidata.org/docs/save-restore/) for more details.

```
sheet   col     row     longname        input   keystrokes      comment
global          null_value      set-option
global          save_filetype   set-option      csv
                        open-file       https://lab24.ilsole24ore.com/ecosistema-urbano/indexT.php      o
indexT                  select-rows             gs      select all rows
indexT  name            setcol-incr             gi      set current column for selected rows to incremental values
```

**Additional context**
Please include the version of VisiData: the latest dev saul.pw/VisiData v2.9dev



Discussion:

Resolving patch:
diff --git a/visidata/save.py b/visidata/save.py
--- a/visidata/save.py
+++ b/visidata/save.py
@@ -163,6 +163,6 @@ def save_txt(vd, p, *vsheets):
 
 BaseSheet.addCommand('^S', 'save-sheet', 'vd.saveSheets(inputPath("save to: ", value=getDefaultSaveName()), sheet, confirm_overwrite=options.confirm_overwrite)', 'save current sheet to filename in format determined by extension (default .tsv)')
 BaseSheet.addCommand('g^S', 'save-all', 'vd.saveSheets(inputPath("save all sheets to: "), *vd.stackedSheets, confirm_overwrite=options.confirm_overwrite)', 'save all sheets to given file or directory)')
-IndexSheet.addCommand('g^S', 'save-selected', 'vd.saveSheets(inputPath("save %d sheets to: " % nSelectedRows, value="_".join(vs.name or "blank" for vs in source)), *selectedRows, confirm_overwrite=options.confirm_overwrite)', 'save all selected sheets to given file or directory')
+IndexSheet.addCommand('g^S', 'save-selected', 'vd.saveSheets(inputPath("save %d sheets to: " % nSelectedRows, value="_".join(getattr(vs, "name", None) or "blank" for vs in selectedRows)), *selectedRows, confirm_overwrite=options.confirm_overwrite)', 'save all selected sheets to given file or directory')
 Sheet.addCommand('', 'save-col', 'save_cols([cursorCol])', 'save current column only to filename in format determined by extension (default .tsv)')
 Sheet.addCommand('', 'save-col-keys', 'save_cols(keyCols + [cursorCol])', 'save key columns and current column to filename in format determined by extension (default .tsv)')
diff --git a/visidata/sheets.py b/visidata/sheets.py
--- a/visidata/sheets.py
+++ b/visidata/sheets.py
@@ -946,7 +946,7 @@ class IndexSheet(Sheet):
     precious = False
 
     columns = [
-        Column('name', getter=lambda c,r: r.names[-1], setter=lambda c,r,v: setitem(r.names, -1, v)),
+        ColumnAttr('name'),
         ColumnAttr('rows', 'nRows', type=int, width=9),
         ColumnAttr('cols', 'nCols', type=int),
         ColumnAttr('keys', 'keyColNames'),


Test patch: