Editorial Workflows

numbers csv to md table

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: csv file from Numbers --> md table --> insert into current md doc --> pdf with internal and external table borders

Shared by: by @ccc, modified by Nikki

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Get File Contents ?
File Name
Blank.csv
In Dropbox
OFF
If File Does Not Exist
  • Empty Output
  • Stop Workflow
Set Variable ?
Variable Name
csv
Value
Input
Replace Selected Text ?
Replacement Text
Input
csv_to_md_table ?
Source Code
# coding: utf-8
import csv
import workflow


def md_table_row(row):
    return '| {} |'.format(' | '.join(row))


def csv_to_md_table(data):
    assert data.strip(), 'Select some csv data to be converted.'
    rows = []
    for i, row in enumerate(csv.reader(x.rstrip(',') for x in data.splitlines()
                                       if x.rstrip(','))):
        rows.append(md_table_row(row))
        if i == 0:
            rows.append(md_table_row('---' for cell in row))
    return '\n'.join(rows)


workflow.set_output(csv_to_md_table(workflow.get_input()))
Convert Markdown ?
Markdown Extras: Footnotes
ON
…Auto-Links
ON
…Strikethrough (~~x~~)
ON
…Superscript (^x)
ON
…Tables
ON
…Smart Quotes etc.
ON
…Strip Metadata Headers
OFF
Add border to HTML table ?
Source Code
#coding: utf-8
import workflow
workflow.set_output(workflow.get_input().replace('<table>', '<table border=1>'))
Set Variable ?
Variable Name
table
Value
Input
Replace V ?
Run the block if
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Document Text ?
Folded Text
  • Include
  • Replace with:
Find / Replace ?
Find
csv
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
table
Update ?
Variable Name
update
Value
Input
Extend Selection ?
Direction
  • Backward
  • Forward
  • Both
Unit
  • Start/End of Document
  • Start/End of Line
  • Number of Characters...
1
Output ?
Replacement Text
update
…End If
Generate PDF Document ?
Source
  • HTML Code
  • Web URL
HTML/URL
Input
Paper Size
  • A4
  • Letter
Page Margins
2cm 2.5cm 2cm 2.5cm
Filename
Table.pdf
in Dropbox
OFF
Overwrite
ON
Open Document ?
File Name
Table.pdf
In Dropbox
OFF