Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Sheets export for form data #71

Open
wants to merge 34 commits into
base: main
Choose a base branch
from

Conversation

pitzer
Copy link
Contributor

@pitzer pitzer commented Aug 24, 2015

This pull request creates a new export option for Google Sheets (GSHEETS).

High level overview on how the Sheets export works:

  • The export requires a Google service account that is configured in (onadata/settings/common.py).
  • The export view (onadata/apps/viewer/views.py) checks for a valid OAuth token and optionally redirects to grant the service account write access to the user's Google Drive.
  • An export can be started with either default settings or advanced settings. Advanced settings allow optional flattening of repeated fields as well as export of the raw XLSForm as part of the export.
  • When started, a celery export task is started (onadata/apps/viewer/tasks.py)
  • The export task uses the SheetsExportBuilder (onadata/libs/utils/google_sheets.py) to dump all form data into a Google Sheet.
  • SheetsExportBuilder add the service account as an editor and uses this account to write data.

Misc:

  • Creates ExportBuilder classes for each export option. This refactors onadata/libs/utils/export_tools.py and moves a lot of code into individual classes/modules.
  • Adds a test for Google Sheets export (onadata/apps/main/tests/test_google_docs_export.py)
  • Removes old Google Docs export (GDOCS) that stopped working as the APIs have changed
  • The UI part of this feature is in Google Sheets export for form data kobocat-template#72

michaelolson and others added 30 commits July 24, 2015 14:26
This commit changes the export framework from using a single
ExportBuilder class and multiple export functions (e.g.
ExportBuilder.to_xls_export and ExportBuilder.to_zipped_csv) to
sub-classing ExportBuilder for specialized exports (e.g XlsExportBuilder
and CsvExportBuilder). This enables better separation of specialized
export logic and cleans up export_tools.py. 

The commit also enables Google Sheets export through the
SheetsExportBuilder and removes old Google Docs export related code.
The test can be executed with:
python manage.py test onadata.apps.main.tests.test_google_sheets_export
- removed filename extension. extensions are now optional
- renamed GSHEETS to Google Sheets
- added a sheet title to export builder
- cleanups in sheets export:
  - remove default worksheet (Sheet1)
  - reuse first row when inserting data
  - export a URL to open the sheet in a browser
- Flattened or tabular output
- Export of XLSForm data
jnm pushed a commit that referenced this pull request Mar 28, 2019
Template for errors related to Excel Analyzer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants