How can I make a fixed width mutliline table in vim/neovim? - text

I want to write a text file for a video script. I want to format the text like a table. It needs to have two columns and any number of rows. I want the text in the 'cells' to be multiline but have a fixed width for the columns.
Here's the effect I'm trying to achieve with three columns. I don't need the scene numbers: Example Script
VimWiki is the best I've found so far, but the columns aren't fixed width and it's difficult or impossible to re-flow the text.
Any suggestions for a better way to do this?

I wonder if the markdown table style is suited for your demands. The example scripts can be found below. I use vim-table-mode to draw these tables, once the table has been created, you can add new rows to it with automatically match the previous width. Here is the demo for this plugin and its GitHub repo can be found here.
| App | Usage | NeedTimeMaster? |
| ------------------- | --------------- | ----------------- |
| Telegram | tec. Chat | No |
| Mail | Communications | No |
| Chrome | Browser | No |
| Things | Tasks | Maybe(slightly) |
| Books | Books | No |

Related

VBA - Remove duplicates which contain less information

First question on Stack, but not my first visit!
Basically I have this huge Excel database (>24 000 rows, merged from different tables) I have been working on for weeks and now that I'm done adding new entries, I have to clean it by removing a lot of duplicates.
The array/table is structured in the following manner :
+---------+-------+--------------------+-------------+--------------------+
| Company | Name | Address | Phone | Email |
+---------+-------+--------------------+-------------+-----------+--------+
| Baij&Co | Steve | 458 Preston avenue | 4156854789 | steve#baij&co.com |
I did search through conventional methods but they don't exactly answer my problem, such as:
Using the "Remove Duplicates" Excel button by selecting all columns to make sure I only keep unique values
Using the filtering method to identify the duplicates and then remove them.
However, my goal is to remove the duplicates for which the given row(s) contains the minimal amount of information, as shown in this example:
+--------- +-------+--------------------+-------------+--------------------+
| Company | Name | Address | Phone | Email |
+--------- +-------+--------------------+-------------+--------------------+
| Baij&Co | Steve | (blank) | 4156854789 | steve#baij&co.com |
| Baij&Co | Steve | (blank) | (blank) | steve#baij&co.com |
| Baij&Co | Steve | 458 Preston avenue | 4156854789 | steve#baij&co.com |
Here, I would like to remove the 1st AND 2nd row as they contain less information (missing address & phone entry) about the same contact.
Does it makes sense..?
I only know the basics of VBA (like creating a userform to add a new contact and fill out the entered information in the right cells) but I struggle with advanced algorithms.
I just know the VBA related function cannot be customized, apart from selecting the columns in which I want to remove the duplicates :
Sheets("Database").Range("ContactsTable").RemoveDuplicates Columns:=1:15, Header:=xlNo
Any ideas?
Thanks fellas!
So I followed #Tim Williams 's suggestion (which is similar to Scott's actually) and did the following:
I realized that email addresses were the unique identifier (or primary key) and I have to delete rows that don't contain any (as it becomes useless to have a contact file without contact information).
I added a column named "Count" and inserted the following formula:
=COUNTIF(N:N; N2)
--> Here, "N:N" is the column containing all email addresses. "N2" being the first cell.
I then sorted the table by descending order on the newly "Count" column to have the most occurrences first.
Then used the "Remove Duplicate" Excel tool and selected the email address column.
As a result, 10 000 rows have been removed (out of 24 000). One thing for sure is this table contains now unique contact files based on the email address. However, I will never know for sure if the most filled row was kept for each contact sadly (unless I spend days comparing both databases, row after row).
Problem solved I guess! Although I would be interested in a VBA-script to do the same (to learn on the algorithm aspect) if anyone knows anything about it :-)
Thanks again!

Cross reference two data sources for matches in Excel 2010

Firstly, thank you for checking my quesiton. I'm new to doing anything advanced in Excel so I'm a bit lost.
I am trying to match names from two different sources that have the same data structure. There are 3 columns, LastName, FirstName, MiddleName. I added a fourth row to denote which organization the record came from and put both sources into one table and made a pivot out of it which works well enough but I'm having a hard time generating any useful data from it.
There are two main objectives once I have them matched.
I need a percentage of matching.
I need to be able to filter out the ones that matched so I can investigate the ones that didn't.
Here is a small example.
+-------------+-----------+------------+------+
| LastName | FirstName | MiddleName | Org. |
+-------------+-----------+------------+------+
| Jones | Mike | Anthony | Org1 |
| Black | Marry | | Org1 |
| Zeek | Winston | E | Org1 |
| Jones | Mike | A | Org2 |
| Black-Smith | Marry | | Org2 |
| Zeek | Winston | E | Org2 |
+-------------+-----------+------------+------+
As you can see out of the list only Winston E Zeek would really match because all three names are exactly the same. Mike Jones won't match because the listed middle names are wrong and Black and Black-Smith won't match because they are technically different last names. These issues with the data are fine at this stage because those are exactly what I'm trying to identify with a larger data set.
Maybe Excel isn't the best for this issue without using VBA? I'm not familiar with VBA which is why I haven't tried it yet and I unfortunately have limited time.
How can I solve this matching problem?
Any assistance and guidance will be appreciated.
Here's a quick idea:
Sort the data by last name, first name, middle name. That should put same/similar names next to each other.
Add a column that, for each row, has a worksheet function like =IF(A3=A2,1,0). This will indicate if this row matches the one above.
Sum the new column... That will tell you the number of matches. Divide by the total number of rows, to get your percentage.
You can modify the function in step 2, to indicate as tight of a match that you want.
Advantage: No VBA needed. Disadvantage: It requires some manual work and interpretation.

Editor or Js extension for Textile Tables

Is there anything similar to:
https://github.com/vkocubinsky/SublimeTableEditor
I have to write quite many tables in textile (Redmine) and I'd like to have them in pretty format
|_. Header1 |
| row1 |
| row2 |
rather than in that ugly one:
|_. Header1|
|row1|
|row2|
Especially when I want to create more sophisticated tables:
|_. Header1 |_. Header2 |
|/2. two lines row1| one|
|two|
|/2. two lines row2| one|
|two|
and it should look like this:
|_. Header1 |_. Header2 |
|/2. two lines row1 | one |
| two |
|/2. two lines row2 | one |
| two |
I'm looking for something for SublimeText/VIM/Notepad++ or JS extension to format tables properly in a text file.
I threw together something to help me with this the other day, and added an output format for textile tables.
http://joecullin.com/data_converter/
You have to choose Redmine table as the output format. I still use this tool every time I want to create a table in redmine. Even for small tables it's easier than typing the markdown by hand. Now I can paste in data from Excel pretty easily, and then paste the result into Redmine.
There are still some kinks in my code, but if I have a large table it gets me to a good starting point quickly. Then I can fix things up by hand. You might look at that code as inspiration if you're considering writing your own javascript.

filtering simultaneously data entries on pivot table/excel

I need to create a pivot table in excel to show which xml pages contain which variables.
The pages look something like:
|Datagroup|Variable|Value|XmlPageName|
|ABC | VarX| 22| pageA1|
|ABC | VarY| 33| pageA1|
|ABC | VarY| 44| pageA2|
|ABC | VarX| 80| pageA3|
|ABC | VarY| 12| pageA3|
|ABC | VarY| 80| pageA4|
First, I want to filter the data on Varx = 22 .
Furthermore, I want apply another filter on Vary =33 to show me all XmlPageName entries that contain simultaneously (VarX= 22 and VarY=33). In this case, it will be pageA1.
I am not able to perform this, as I can't apply 2 filters simultaneously.
I couldn't do this with regular filtering and nor with pivot tables.
I want to mention that the excel file is huge, so "eyeball" filtering takes too much time.
Any ideas on how to achieve this?
Many thanks,
Dola
What you are trying to do seems pretty straightforward:
You can use a data filter:
Although I'm not sure what you mean by "eyeball" filtering. Good Luck.

Use heading as column

I have a spreadsheet set out similar to below:
Weekly Report | 25/06/2012
-------------------------------
Name | Course |
-------------------------------
Peter | Maths |
-------------------------------
John | English |
-------------------------------
James | History |
-------------------------------
Each week a new report is sent with sometimes different and sometimes the same people on different courses. I want to use SSIS to create an extra column to show the date which is usually in cell b3 of the spreadsheet.
So the final thing would look like
Weekly Report | 25/06/2012
--------------------------------------------
Name | Course | Date |
--------------------------------------------
Peter | Maths | 25/06/2012 |
--------------------------------------------
John | English | 25/06/2012 |
--------------------------------------------
James | History | 25/06/2012 |
-------------------------------------------
Hopefully explained myself there. I am rather new to SSIS so don't know if it's really obvious or something more difficult.
Thanks for clarifying your question. You have two steps: extracting the date and turning it into a column. I would probably use an Execute SQL task to query the Excel sheet and map the date to a package variable. Then you can use that variable in a Derived Column transformation to add it to the data set being processed.
Finally, you might want to consider not using SSIS at all. If your source is Excel and your destination is MySQL, then using SSIS means you also need SQL Server. So depending on your environment writing your own script or program might be simpler.

Resources