max-barry / google-drive-cms

A content management system (CMS) built on an interface everyone understands (n.b. No longer maintained)
https://drivecms.xyz
MIT License
396 stars 36 forks source link

'Invalid Argument' when exporting #7

Open m4rrc0 opened 7 years ago

m4rrc0 commented 7 years ago

Apparently exporting does not work out of the box. I created a dummy value to test the export feature and I get a not-to-meaningful error 'Invalid Argument'.

bseaver commented 7 years ago

Error in running "Google Drive CMS" / "Export content" option.

Steps to duplicate:

  1. Open https://www.drivecms.xyz/documentation.html
  2. Under Installation, option 2: Make a copy of the core template yourself using (this link)[https://docs.google.com/spreadsheets/d/15ifxjEo9nVXTbeX7mwLnW-F5yu96u9IF1RL3wHoYLbs/edit?usp=sharing]
    • Click on the link - which opens Google Drive CMS Master sheet in View only mode
  3. Select menu option "File" / "Make a copy..."
  4. Change the name of the copy Test Export Google Drive CMS, click OK
  5. In cell A1 enter test_key
  6. In cell A3 enter test value
  7. Select menu option "Google Drive CMS" / "Export content"
  8. Follow any prompts to authorize and allow Drive CMS to work with your Google Drive files.

At this point as of June 15, 2017 9:00 am (Americas - Los Angeles time) I see the error message:

The following is an unvetted workaround to the error by following these steps:

  1. Select menu option "Tools" / "Script Editor"
  2. Click on Export.gs
  3. In the Export.gs script, go to line 42 which says:
    • var createdFile = exportsFolder.createFile(fname, json, MimeType.JSON);
  4. Change MimeType.JSON to MimeType.PLAIN_TEXT
  5. Select menu option "File" / "Save"
  6. Close Drive CMS tab
  7. Back in the Test Export Google Drive CMS tab select menu option "Google Drive CMS" / "Export content"
  8. Receive the message: A JSON file has been created in the same directory as this spreadsheet.
bseaver commented 7 years ago

Another workaround for the time being could be to omit the third parameter of the createFile function. So line 42 could simply be:

This might be a safer choice if "MimeType.PLAIN_TEXT" is incorrect.

In any case, after making the workaround, see if you can fully utilize your exported file. Also try adding some UTF-8 multi byte characters and verifying these are properly exported and used by your down stream system.

metafeather commented 7 years ago

I ran into this today and implemented the same the workaround.