Hey everyone,
I’m trying to figure out how to move data from tables in Google Docs to a Google Sheet automatically. All my files are in the same folder on Google Drive.
Here’s what I want to do:
- Go through multiple Google Docs
- Find tables in each doc (they all have the same format)
- Copy the data from these tables
- Paste it into rows in a Google Sheet
- Make this happen automatically once a day
I’m stuck on the first step. How do I access different Doc files and get the table data out? Any ideas would be super helpful!
Also, the folder is private, but all the Docs and the Sheet are in it.
Thanks in advance for any help!
hey man, i’ve done something similar before. you’ll need to use google apps script for this. basically, you write a script that goes through your docs, finds the tables, and copies the data to your sheet. then set up a trigger to run it daily. it’s not super complicated but might take some trial and error. good luck!
I’ve tackled a similar project before, and Google Apps Script is definitely the way to go. Here’s what worked for me:
First, create a script in your Google Sheet (Extensions > Apps Script). You’ll need to write a function that loops through your Docs, extracts table data, and adds it to your Sheet.
The trickiest part is accessing the Docs and pulling out table data. Use DriveApp to get your folder, then loop through files. For each Doc, use DocumentApp to open it and getTables() to find tables. Extract the data cell by cell.
Once you’ve got the data, use SpreadsheetApp to add it to your Sheet. You can append it to the end or overwrite existing data, depending on your needs.
Lastly, set up a trigger to run your script daily. Go to Triggers in the Apps Script editor and create a time-based trigger.
It takes some trial and error, but once it’s set up, it’s a huge time-saver. Good luck with your project!