To collect the same cell from repeated inventory tables, export each table as CSV, then run a Finder shortcut that reads that position and creates an overview. This walkthrough collects B3, keeps each source filename, and refuses to overwrite an existing result.
Choose the right inputs before building the shortcut
This workflow is for someone who maintains several inventory tables with the same layout and wants one row per table in a separate overview. The example uses three disposable files containing synthetic counts. Each file represents one exported table; the target is column B, row 3, including the header row.
Keep three things distinct: the spreadsheet document, the table inside it, and the exported CSV file. Apple’s Numbers documentation allows CSV exports either as separate files for each table or with tables combined. For this task, choose separate files: combining tables can change where the target record appears. CSV exports contain cell values, so the resulting overview is a snapshot. Export to other file formats in Numbers on Mac.
The shortcut below delegates extraction to a small Python program. It does not treat a Numbers document or Excel workbook as plain text, and it does not assume that accepting a spreadsheet file gives an action access to its cells. Apple documents how to inspect an action’s accepted input and resulting output through its information panel. Use that panel when checking the actions available on your Mac. Navigate the action list in Shortcuts on Mac.
Use this decision table before starting:
| Starting point | Preparation for this workflow |
|---|---|
| One matching table in each Numbers document | Export each table as CSV. |
| Several matching tables in one document | Export separate CSV files and identify the intended tables. |
| Existing comma-delimited CSV files | Confirm their encoding, layout, and target position. |
| Different layouts or shifting inventory rows | Standardize the disposable examples first; a fixed coordinate alone cannot identify the intended quantity. |
For the example, every source must have Counted units in A3 and the desired value in B3. Checking the adjacent label adds a useful diagnostic: a shifted row stops the run instead of quietly collecting an unrelated value. It cannot detect every possible layout mistake, so confirm both cells when preparing the inputs.
Prepare disposable inventory files
You need Python 3 installed separately for this example. With the standard installer from Python’s website, executable links are placed in /usr/local/bin/. The commands below use /usr/local/bin/python3 explicitly, avoiding dependence on the shortcut’s command search path. Follow the installation instructions for your supported Python release, then check that this command works. Using Python on macOS.
/usr/local/bin/python3 --version
If that path is absent, complete the Python installation before proceeding. The program uses only Python’s standard library; no additional packages are required. Apple’s Terminal guide explains that commands can be invoked using the executable’s complete pathname followed by its arguments. Execute commands and run tools in Terminal on Mac.
To create the synthetic inputs, paste this complete command into Terminal. It creates Inventory Demo on your Desktop and stops if that folder already exists. Use a fresh disposable folder rather than merging these examples into an existing directory.
/usr/local/bin/python3 - <<'PY'
import csv
from pathlib import Path
root = Path.home() / "Desktop" / "Inventory Demo"
root.mkdir()
examples = [
("Birch", "A", "12"),
("Cedar", "B", "7"),
("Maple", "C", "0"),
]
for name, bin_name, count in examples:
with (root / f"{name}.csv").open(
"x", encoding="utf-8", newline=""
) as handle:
csv.writer(handle).writerows([
["Item", "Value"],
["Bin", bin_name],
["Counted units", count],
])
print(root)
PY
For a separate test of the Numbers export step, open one disposable CSV in Numbers and export it to a different disposable folder using File > Export To > CSV. Choose a file for each table, leave Include table names off, and use UTF-8 encoding. Inspect the exported table to confirm that A3 and B3 still contain the intended label and value. These export options are documented by Apple. Numbers export settings.
Do not rename a spreadsheet’s extension to .csv as a substitute for exporting it. This program expects actual comma-delimited text. Keep the three original synthetic CSV files together for the walkthrough that follows.
Create the program that builds the overview
Save the following complete program as overview.py inside Inventory Demo, using a plain-text editor. Confirm that the filename ends in .py, rather than .py.txt. The program accepts source file paths as arguments, reads B3, and creates overview.csv in their shared folder.
import csv
import io
import sys
from pathlib import Path
ROW, COLUMN = 2, 1 # Zero-based: B3
LABEL = "Counted units"
def build_overview(arguments):
if not arguments:
raise ValueError("Select at least one source CSV.")
paths = [Path(name).expanduser().resolve(strict=True)
for name in arguments]
if len(set(paths)) != len(paths):
raise ValueError("The same source was supplied twice.")
if len({path.parent for path in paths}) != 1:
raise ValueError("Keep all source CSVs in one folder.")
rows = []
for path in sorted(paths, key=lambda p: p.name):
if (not path.is_file() or path.suffix.lower() != ".csv"
or path.name.casefold() == "overview.csv"):
raise ValueError(f"Not a source CSV: {path.name}")
with path.open(encoding="utf-8-sig", newline="") as handle:
records = list(csv.reader(handle, strict=True))
if len(records) <= ROW or len(records[ROW]) <= COLUMN:
raise ValueError(f"{path.name}: B3 does not exist.")
if records[ROW][0] != LABEL:
raise ValueError(f"{path.name}: A3 must be {LABEL!r}.")
value = records[ROW][COLUMN]
status = "blank" if value.strip() == "" else "present"
rows.append([path.name, "B3", value, status])
buffer = io.StringIO(newline="")
writer = csv.writer(buffer)
writer.writerow(["Source file", "Cell", "Value", "Status"])
writer.writerows(rows)
return paths[0].parent / "overview.csv", buffer.getvalue()
def main(arguments):
try:
destination, content = build_overview(arguments)
with destination.open("x", encoding="utf-8", newline="") as handle:
handle.write(content)
except (OSError, ValueError, csv.Error) as error:
print(f"Stopped: {error}", file=sys.stderr)
return 1
print(f"Created: {destination}")
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
The program uses a CSV parser rather than splitting text at commas or line breaks. Python’s reader returns fields as strings, and its documentation specifies opening CSV files with newline="". This accommodates quoted fields containing commas or embedded line breaks. The program preserves the extracted value without adding it up or converting it to a number. CSV file reading and writing.
Several deliberate limits make the result easier to check. Every input must exist, all resolved source paths must share one folder, and duplicate resolved paths are rejected. The program sorts by filename rather than relying on Finder selection order. It also rejects an input named overview.csv, preventing accidental inclusion of the previous result.
All sources are read and checked before output creation begins. A missing B3 or an unexpected label in A3 stops the run. An existing but empty B3 produces a row marked blank; a value of 0 remains 0 and is marked present. Thus an absent cell, an empty cell, and a zero count have different outcomes.
The output uses exclusive creation mode, "x". Python documents that this mode fails when the destination already exists. The program therefore neither replaces the previous overview nor invents a numbered filename. A failure during the actual write can still leave an incomplete new file; inspect any file left after a write error before retrying. Python’s file-opening modes.
Connect the program to a Finder shortcut
Create a shortcut named Inventory Overview in Shortcuts. Open its Details, enable Use as Quick Action, and select Finder. In the input configuration, keep Files enabled and turn off unrelated content types. Apple documents Finder availability for shortcuts accepting files or folders, as well as the controls for limiting accepted input. Run a shortcut while working on your Mac, Limit the input for a shortcut.
Set the no-input behavior to Stop and Respond, with a message such as Select the source CSV files in Finder. This prevents an empty selection from becoming an ambiguous run. The option and its response field are described in Apple’s input configuration guide. Choose the response to missing input.
Add Run Shell Script. Set Shell to /bin/zsh, connect its Input to Shortcut Input, and set Pass Input to as arguments. Replace its sample script with this complete command:
/usr/local/bin/python3 "$HOME/Desktop/Inventory Demo/overview.py" "$@"
Keep the quotation marks. The quoted "$@" passes the incoming arguments separately, preserving filenames containing spaces. The script pathname is quoted for the same reason. The zsh manual documents positional parameters and separate expansion of quoted array elements; Apple’s Terminal guide also explains pathname quoting. Parameters, Specify files and folders in Terminal.
If Shortcuts requires scripting to be enabled, choose Shortcuts > Settings > Advanced and select Allow Running Scripts. Apple documents this setting under allowing scripts to run from a shortcut. Advanced Shortcuts settings.
The configured flow is: selected file objects enter the shortcut, their paths become shell arguments, and Python reads those files and writes the overview. The shell action’s successful textual result is a Created: message containing the destination pathname. That message is not the CSV file itself. No subsequent save action is needed because the program has already created the file.
In Finder, select only Birch.csv, Cedar.csv, and Maple.csv. Control-click the selection and choose Quick Actions > Inventory Overview. If the shortcut is missing, use More > Customize to inspect the enabled Finder extensions, then recheck its accepted input types. Apple documents both Finder Quick Actions customization and adding shortcuts to that menu. Perform quick actions in the Finder on Mac.
Check the result and handle repeat runs
Open overview.csv from the demo folder in Numbers. With the supplied synthetic files, its contents should be:
Source file,Cell,Value,Status
Birch.csv,B3,12,present
Cedar.csv,B3,7,present
Maple.csv,B3,0,present
Check that there is one output row for every selected source and that the filenames identify the intended tables. The example’s values are illustrative, not measured inventory results. The program reports whether a value is present; it does not check that the value is a valid count.
Use this diagnostic sequence when something differs:
- No shortcut in Finder: check its
Findersetting, acceptedFilesinput, and enabled extension. - Missing executable or script: confirm the Python pathname and that
overview.pyremains in the specified demo folder. - Missing
B3or wrongA3: inspect the source’s exported records and export options before changing the program. - An unexpected blank: inspect
B3; the program deliberately leaves empty values empty. - Destination already exists: rename the previous disposable overview or move it outside the source folder before rerunning.
You can also invoke the same shortcut from Terminal to check the input route. Apple documents -i for passing file inputs; piping a pathname instead passes text. Use the explicit files below, without an output flag, because the Python program owns output creation. The same name-collision rule still applies. Run shortcuts from the command line.
shortcuts run "Inventory Overview" -i \
"$HOME/Desktop/Inventory Demo/Birch.csv" \
"$HOME/Desktop/Inventory Demo/Cedar.csv" \
"$HOME/Desktop/Inventory Demo/Maple.csv"
Each new overview represents the CSV files selected for that run. Changes in a spreadsheet require another export and another run. Keeping the source filename, checking the adjacent label, and distinguishing blank values from zero make this small overview easier to verify before you use it for your next inventory review.
Sources
- Export to other file formats in Numbers on Mac — Apple.
- Navigate the action list in Shortcuts on Mac — Apple.
- Using Python on macOS — Python Software Foundation.
- Execute commands and run tools in Terminal on Mac — Apple.
- csv — CSV file reading and writing — Python Software Foundation.
- Built-in functions — Python Software Foundation.
- Run a shortcut while working on your Mac — Apple.
- Limit the input for a shortcut when run from another app on Mac — Apple.
- 15 Parameters — The Zsh Project.
- Specify files and folders in Terminal on Mac — Apple.
- Advanced Privacy and security settings in Shortcuts on Mac — Apple.
- Perform quick actions in the Finder on Mac — Apple.
- Run shortcuts from the command line — Apple.