SQL-style analysis in Shortcuts


I have two data sets stored as CSV files accessible by Files.app on iOS. The format of the data is such that each column is a variable, and each row is an observation. I would like to perform some SQL-style data analysis on these data sets, triggered using Shortcuts.app, such as:

  • Joining the data sets
  • Creating a “Choose from Menu” action, with the items of the menu all observations for a specific variable
  • Filtering data based on the “Choose from Menu” selection
  • Calculating simple summary statistics, such as the sum of the observations for a given variable.

Possible solutions

Utilising macOS

If I had a Mac switched on all the time - or if I wanted to purchase a MacStadium subscription - I could write scripts in SQL, R, Python, or another data analysis language. I could then access the Mac using SSH, and run a Shortcut to access the script over SSH. However, I don’t want to rely on my Macbook Pro being switched on all the time, and I’d rather not purchase a MacStadium subscription if I can help it.


Python is becoming more and more used for data analysis, so I was hopeful that I might be able to use Pythonista to analyse data on iOS. However, commonly used data analysis packages such as pandas and scipy are not locally available on Pythonista (e.g. https://forum.omz-software.com/topic/5624/is-pandas-supported-on-pythonista). Furthermore, Pythonista lacks proper Shortcuts parameter support, and I would need to store the CSV files in Dropbox, which I don’t want to do.


Unlike Pythonista, Scriptable does have Shortcuts support, although I’m not well-versed in Javascript. For example:

  • Is it possible to load data in CSV format as a two-dimensional array using Javascript in Scriptable?
  • Is it possible to use packages such as JQuery in Scriptable to query data using SQL-like language?

I understand that you would like to do this using Shortcuts, but for what you need you might want to look at the Carnets app (https://apps.apple.com/us/app/carnets/id1450994949) which allows the creation of Jupyter notebooks on iOS and does include pandas and other analysis packages. I don’t think Carnets supports Shortcuts at this time



Interesting - I’ll take a look, although I would much prefer to use Shortcuts if possible.

Other possible solutions

Shortcuts actions

It is possible to perform some rudimentary analysis using text-based actions in Shortcuts, such as splitting text by a certain character (new line, comma), matching text using regular expressions, etc. However, this is sensitive to quoted commas in the text. More sophisticated solutions have been detailed at:

However, it seems like a lot of annoying boilerplate code will be involved if I went down this path…

Just tried using Carnets… and it deleted all the files in my Shortcuts folder in iCloud :cry:

What were you doing when that happened? I use Carnets and my Shortcuts folder is fine. I don’t know why Carnets would access that folder

I tried moving a Jupyter notebook into my Shortcuts directory, to see if I could access data stored in the Shortcuts directory using Python code in the notebook. Next minute…!

I have no idea why that would happen. I can only suggest that you reach out to the Carnets developer @nholzschuch on Twitter

try this


it does basic parsing (without checking for quoted commas, and assuming a header row with variable names) and outputs descriptive stats for selected variables - pass it a csv file in the share sheet

Thanks! Will take a look :smile:

  1. Once the file is read in Scriptable you could then display it in a table within Scriptable, or render it as HTML in a WebView, there are a few options, but yes definitely possible.
  2. I’ve seen some examples of people using 3rd-party libraries in Scriptable (e.g. here: Use moment.js in Scriptable), but it’s not exactly supported…you’d basically need to get the whole source code for the library and add it to Scriptable. I haven’t really seen jQuery used in this way though.