I am writing a play on Google Docs and I am looking to have a table either in Google Docs or a separate Google Sheet where I can see how many times a word/name is mentioned in real time. I understand I can do this simply by using the native ctrl+F feature but unfortunately, that's hard to remember to do after writing each scene and it would be great to see how many lines I have different characters delivering as I write.
Asked
Active
Viewed 32 times
2 Answers
0
kinda vague question so here is example of counting phrase lorem ipsum
:
=INDEX(SUM(LEN(REGEXREPLACE(REGEXREPLACE(LOWER(A1:A),
"lorem ipsum", "♥"), "[^♥]+", ))))

player0
- 124,011
- 12
- 67
- 124
-
1Thanks for this! I guess this would require me to post all 90 pages of writing so far in Google Sheets but it still works. I wonder if there is a way to make it to scan my google doc instead of all of the A column? – MoMoney Aug 12 '21 at 21:46
-
@MoMoney see if this helps: https://techpp.com/2021/03/24/import-a-google-docs-document-into-google-sheets/ – player0 Aug 12 '21 at 21:50
0
You should accept Player()'s
answer.
However in answer to the subsequent question about getting paragraphs into a spreadsheet, the below app script function will get it done by putting each paragraph in a cell (Starting in cell A1) and moving down through the document.
Be cautious of the permission warning signs that appear, these are not to be completely dismissed without reviewing. Given that you can see the actual code, you can process without too much worry (even if you don't understand it, you can rest assured that there's a community of smart folks on here who would ban me if I gave you code that was harmful).
function putParagraphsInCells(){
var macBethPartII = DocumentApp.openById('??????????????'); //change to match yours
var allParagraphs = macBethPartII.getBody().getParagraphs();
var theResult = [];
for(var i=0;i<allParagraphs.length;i++){
theResult.push([allParagraphs[i].getText()])
}
const ss = SpreadsheetApp.openById('?????????');//or whatever
const ws = ss.getSheetByName("Sheet1");
ws.getRange(1,1,allParagraphs.length,1).setValues(theResult);
}

pgSystemTester
- 8,979
- 2
- 23
- 49