A simple Google Document that helps you make tables. Useful for teachers.
- You can simply make a copy of this document and follow the instructions.
A simple Google Document that helps you make tables. Useful for teachers.
| function onOpen() { | |
| var ui = DocumentApp.getUi(); | |
| ui.createMenu('Actions') | |
| .addItem('Make Table', 'appendTable') | |
| .addToUi(); | |
| ui.alert( | |
| 'How this works:', | |
| 'Type or paste any text. Blank lines indicate where to make a new row. Then choose "Make Table" from the "Actions" menu.', | |
| ui.ButtonSet.OK); | |
| } | |
| function appendTable() { | |
| var body = DocumentApp.getActiveDocument().getBody(); | |
| var text = body.getText(); | |
| var blankLines = new RegExp("\n{2}") | |
| var blocks = text.split(blankLines); | |
| var cells = []; | |
| blocks.forEach(function (item, index, arr) { | |
| cells.push(item.split("\n")); | |
| }); | |
| body.appendTable(cells); | |
| } |