Google Docs to Elementor JSON template

bernard

BuSo Pro
Joined
Dec 31, 2016
Messages
2,525
Likes
2,215
Degree
6
Does anyone have any idea on where to begin in turning Google Doc into Elementor JSON?

I was thinking about how to solve my challenges with spending an inordinate amount of time on formatting my posts in Elementor, which I otherwise consider a competitive advantage. Copy pasting from Google Docs, then adding all the different elements and templates. It's a real chore, that takes up 1-2 hours pr. post.

Outsourcing to freelance or agency is one possibility, as is hiring some student workers/interns. These are decent possibilities, specifically the student workers, but they also add a significant extra cost to each article (I'm thinking $30-$50/post).

Then I considered, you can export and import entire posts in Elementor in JSON. Why don't I write a script in Google Docs, that will take a google doc, marked up by some sort of tags and transform it into an Elementor JSON file?

That way, I can get my text written in Google Docs, add the tags like: [product review box][shortcode][paragraph][/product review box], maybe with a custom menu. Then I could run the script and it would transform the entire thing to Elementor JSON.

That would take some time to code, but it would also save me 30-50 USD pr. post, which would rather quickly make it a worthwhile endeavour.
 
Yes - I've used Google Apps Scripts a ton.

So let's say you have (columns) as an example.

ID | Slug | Title | Categories | Tags | Body | Excerpt | ACF_1 | ACF_2 | ACF_n


The idea would be to do this


Make a class called ElementorJson, when it's initialized, it will take all posts without an ID, turn them into JSON with a given format (Google Apps Scripts have methods for turning rows and columns into JSON, and you can use the default JS JSON methods of course.

This class can have "private" methods, like

```
_parse_token(token, value) {
# replace tokens from body
}
```
_insert_map

_spin_text

or whatever you want.


Then you can either store the JSON to google drive, or you can expose the sheet as en endpoint.



However, editing body content in Google Sheets will be a major pain in the ass. I'd go for airtable, which already has an API out of the box, and support for more advanced fields like WYSIWYG, date, JSON ++

Every time you add a post, have Zapier pull the data and store it somewhere accessible. Then parse that file in WP.
 
Just like any programming question, an example of the input (Google Doc) and output (page layout) would really help.

Personally, I would probably go for a mix of ACF, dynamic content fields in elementor, and bespoke elementor widgets, or ACF and coded bespoke post template. Then the input is just straight form fields in regular WP backend.
If each post needs the flexibility to twerk individual sections etc, then I would train someone instead
 
Back