Web Application for Data Import from XLSX Into a Relational Database

Total Page:16

File Type:pdf, Size:1020Kb

Web Application for Data Import from XLSX Into a Relational Database Masaryk University Faculty of Informatics Web application for Data Import from XLSX into a Relational Database Bachelor’s Thesis Samuel Toman Brno, Spring 2021 Masaryk University Faculty of Informatics Web application for Data Import from XLSX into a Relational Database Bachelor’s Thesis Samuel Toman Brno, Spring 2021 This is where a copy of the official signed thesis assignment and a copy ofthe Statement of an Author is located in the printed version of the document. Declaration Hereby I declare that this paper is my original authorial work, which I have worked out on my own. All sources, references, and literature used or excerpted during elaboration of this work are properly cited and listed in complete reference to the due source. Samuel Toman Advisor: Mgr. Luděk Bártek Ph.D. i Acknowledgements I would like to express gratitude towards my advisor Mgr. Luděk Bártek, Ph.D., for always being available to patiently answer all my questions. Likewise, I would like to thank my consultants JUDr. Ing. František Kasl, Ph.D. and JUDr. Pavel Loutocký, Ph.D., BA. iii Abstract Spreadsheets are often used in office environments due to their user- friendliness coupled with their practicality. The majority of spread- sheet users are non-professional programmers, and as such, keeping them user-friendly remains a high priority. Their intuitiveness comes at a price, however. Due to their design, they are not well suited for stor- ing and querying large, structured data. They are nevertheless often relegated to precisely that role. The conversion process from a spread- sheet to a relational database can often be problematic and requires some level of technical knowledge. The main objective of this thesis is to provide a semi-automatic means of importing spreadsheets into a relational database, easing the process of conversion while still pro- viding enough modularity to design a suitable database schema. The thesis examines existing solutions and addresses their shortcomings in a resulting web application. As part of the thesis, the application was incorporated into an existing system called “CyQualf.” iv Keywords database systems, MySQL, PHP, web application, Docker v Contents Introduction 1 1 Data representation in XLSX documents and SQL databases 3 1.1 Office Open XML Workbook (XLSX) . .3 1.1.1 Data representation . .4 1.2 Relational database . .4 1.2.1 Relational model . .5 2 Project requirements 7 2.1 Functional requirements . .7 2.1.1 Mapping schema . .8 2.1.2 HTTP API . .9 2.2 Non-functional requirements . .9 3 Exploration of existing XLSX to SQL conversion tools 11 3.1 Web converters . 11 3.1.1 SQLizer . 11 3.1.2 Other web converters . 12 3.2 Desktop application converters . 13 3.3 Conclusion . 14 3.3.1 Missing functionality . 14 4 Technology stack and frameworks 17 4.1 PHP language . 17 4.2 PHP spreadsheet parser . 17 4.2.1 PhpSpreadsheet . 18 4.3 JavaScript . 19 4.3.1 React . 19 4.4 Docker . 20 5 Implementation and project structure 21 5.1 Project structure . 21 5.2 Server-side . 22 5.2.1 Server-side file structure . 22 5.2.2 Parsing the mapping schema . 23 5.2.3 Mapping relationships . 24 vii 5.3 Client-side . 26 5.3.1 Client-side file structure . 26 5.3.2 Front-end design components . 27 6 Deployment 29 6.1 Docker project structure . 29 6.1.1 Mariadb service . 29 6.1.2 Adminer service . 30 6.1.3 Php service . 30 6.1.4 Server service . 31 6.1.5 React-frontend service . 31 6.2 Summary of configuration files . 32 7 Conclusion 33 Bibliography 35 A Usage example 37 A.1 Running the application . 37 A.1.1 Service configurations . 37 A.2 Using the GUI . 38 A.3 Using the API . 39 B Graphical user interface design 43 viii List of Tables 1.1 One-to-many relationship represented in XLSX. 4 5.1 An example worksheet Employee 25 ix List of Figures 4.1 A comparison of download counts (from NPM package manager) of the three most popular JavaScript front-end frameworks/libraries. Downloads measured from April 2019 to April 2021. 20 5.1 A class diagram of the mapping schema data structure. 24 5.2 Component decomposition of the webpage GUI. 28 A.1 A single table of the mapping schema. 38 A.2 A mapping schema containing two tables. 39 B.1 The webpage GUI on a desktop-sized screen width. 43 B.2 The webpage GUI on a smartphone-sized screen width. 44 xi Introduction Spreadsheet programs are often considered to be a significant factor in the introduction and establishment of personal computers (PCs), due to the spreadsheets being one of the main use-cases for the early PCs [1, p. C-177]. The first spreadsheet application for PCs called VisiCalc, originally released for Apple II in 1979, was considered a huge commercial success. It was often referred to as Apple II’s first “killer app” [2], meaning a program so essential, one would buy a computer just to be able to use it. As seen from their continued success, it is clear that spreadsheets provide essential services, often considered irreplaceable by their users. However, as is the case with any software, they are not the tool for everything. Spreadsheets work well enough when manipulating or analyzing manageably small data; they begin to struggle once the data gets sufficiently big, however. Among the many problems exacerbated by a growing dataset are poor performance, data redundancy, error proliferation, and many more. Their structure does not allow them to link and cross-reference data between tables easily, enforce data integrity rules, or retrieve data using complex querying functions. All of the above-mentioned are desirable traits for a system maintaining a sizeable or a critical dataset. In conclusion, a spreadsheet is not a database; it is not designed for the purpose of long-term storage of large or essential data. Thus, a problem of conversion to a proper database emerges. The existing web applications for importing spreadsheets into relational databases do not offer a solution functionally sufficient enough, to design a relational schema and subsequently map the data into it. The only available option is a simple import of the entire worksheet into the database as-is, without the option of establishing relations. To fully leverage the advantages of the relational model, the imported tables would have to be further processed into a new schema, which might be an uneasy procedure. This thesis aims to develop a web application capable of importing spreadsheet data into a database according to a user-defined schema, using a pleasant graphical interface. 1 The first chapter of the thesis contains a quick overview andcom- parison of data representation in spreadsheets and relational databases. The second chapter describes the project requirements, detailing what the application should be capable of and how it should behave. The third chapter explores existing solutions, compares both web and desktop variants, and draws a conclusion based on this analysis. The selected technologies and the reasoning for their selection are outlined in the following, fourth chapter. The fifth chapter details the project structure and selected parts of the implementation. The following sixth chapter explains the deployment of the application using Docker, de- tailing individual Docker services comprising the project. The seventh chapter contains a conclusion while summarizing the thesis. Addi- tionally, two appendices concerning the usage of the application and its graphical design are appended at the end of the thesis. 2 1 Data representation in XLSX documents and SQL databases This chapter offers an overview of the XLSX format in comparison to relational databases. It describes the differences in data represen- tation, structure, and functionality between the two paradigms. A short insight into the file structure of XLSX is also given to deepen the understanding of the format. 1.1 Office Open XML Workbook (XLSX) XLSX is a spreadsheet format designed by Microsoft, introduced to- gether with Microsoft Excel 2007 and standardized by Ecma Interna- tional, ISO1 and IEC2. The format was designed to comply with the Office Open XML specification [3] and served as a successor tothe previous proprietary Excel Binary File Format (XLS) used by earlier versions of Microsoft Excel. Since its inception in December 2006, XLSX has become widely supported by most modern spreadsheet programs due to it being a standardized format. In contrast to the previous XLS, which is a binary format, XLSX is a ZIP-compressed3 archive containing several XML4 files. Compared to its predecessor, XLSX offers a significant file size reduction [4, p. 324]. As a ZIP archive, the file can be unpacked, revealing the underlying structure of the format: • [Content_Types].xml - Contains references to all XML files included in the package. • _rels/ - A folder consisting of a single XML file storing package- level relationships. 1. International Organization for Standardization 2. International Electrotechnical Commission 3. ZIP is an archive file format, supporting lossless compression 4. Extensible Markup Language format designed to be both human-readable and machine-readable 3 1. Data representation in XLSX documents and SQL databases Table 1.1: One-to-many relationship represented in XLSX. Department Department Employee Employee Tag Name Wage ENG Engineering Julian Johnson 35000 ENG Engineering Jane Jones 39000 ACC Accounting Martin Moore 28000 ACC Accounting Larry Lewis 46000 • docProps/ - A folder containing XML files with overall doc- ument properties, such as author, last modification date, and metadata about the file’s content. • xl/ - This is the main folder, branching into further subfolders and XML files. As a whole, it contains the details about the workbook contents and the data itself.
Recommended publications
  • The Microsoft Office Open XML Formats New File Formats for “Office 12”
    The Microsoft Office Open XML Formats New File Formats for “Office 12” White Paper Published: June 2005 For the latest information, please see http://www.microsoft.com/office/wave12 Contents Introduction ...............................................................................................................................1 From .doc to .docx: a brief history of the Office file formats.................................................1 Benefits of the Microsoft Office Open XML Formats ................................................................2 Integration with Business Data .............................................................................................2 Openness and Transparency ...............................................................................................4 Robustness...........................................................................................................................7 Description of the Microsoft Office Open XML Format .............................................................9 Document Parts....................................................................................................................9 Microsoft Office Open XML Format specifications ...............................................................9 Compatibility with new file formats........................................................................................9 For more information ..............................................................................................................10
    [Show full text]
  • International Standard Iso/Iec 29500-1:2016(E)
    This is a previewINTERNATIONAL - click here to buy the full publication ISO/IEC STANDARD 29500-1 Fourth edition 2016-11-01 Information technology — Document description and processing languages — Office Open XML File Formats — Part 1: Fundamentals and Markup Language Reference Technologies de l’information — Description des documents et langages de traitement — Formats de fichier “Office Open XML” — Partie 1: Principes essentiels et référence de langage de balisage Reference number ISO/IEC 29500-1:2016(E) © ISO/IEC 2016 ISO/IEC 29500-1:2016(E) This is a preview - click here to buy the full publication COPYRIGHT PROTECTED DOCUMENT © ISO/IEC 2016, Published in Switzerland All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized otherwise in any form orthe by requester. any means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address below or ISO’s member body in the country of Ch. de Blandonnet 8 • CP 401 ISOCH-1214 copyright Vernier, office Geneva, Switzerland Tel. +41 22 749 01 11 Fax +41 22 749 09 47 www.iso.org [email protected] ii © ISO/IEC 2016 – All rights reserved This is a preview - click here to buy the full publication ISO/IEC 29500-1:2016(E) Table of Contents Foreword .................................................................................................................................................... viii Introduction .................................................................................................................................................
    [Show full text]
  • [MS-XLSX]: Excel (.Xlsx) Extensions to the Office Open XML Spreadsheetml File Format
    [MS-XLSX]: Excel (.xlsx) Extensions to the Office Open XML SpreadsheetML File Format Intellectual Property Rights Notice for Open Specifications Documentation . Technical Documentation. Microsoft publishes Open Specifications documentation (“this documentation”) for protocols, file formats, data portability, computer languages, and standards support. Additionally, overview documents cover inter-protocol relationships and interactions. Copyrights. This documentation is covered by Microsoft copyrights. Regardless of any other terms that are contained in the terms of use for the Microsoft website that hosts this documentation, you can make copies of it in order to develop implementations of the technologies that are described in this documentation and can distribute portions of it in your implementations that use these technologies or in your documentation as necessary to properly document the implementation. You can also distribute in your implementation, with or without modification, any schemas, IDLs, or code samples that are included in the documentation. This permission also applies to any documents that are referenced in the Open Specifications documentation. No Trade Secrets. Microsoft does not claim any trade secret rights in this documentation. Patents. Microsoft has patents that might cover your implementations of the technologies described in the Open Specifications documentation. Neither this notice nor Microsoft's delivery of this documentation grants any licenses under those patents or any other Microsoft patents. However, a given Open Specifications document might be covered by the Microsoft Open Specifications Promise or the Microsoft Community Promise. If you would prefer a written license, or if the technologies described in this documentation are not covered by the Open Specifications Promise or Community Promise, as applicable, patent licenses are available by contacting [email protected].
    [Show full text]
  • Office File Formats Overview
    Office File Formats Overview Tom Jebo Sr Escalation Engineer Agenda • Microsoft Office Supported Formats • Open Specifications File Format Documents and Resources • Benefits of broadly-adopted standards • Microsoft Office Extensibility • OOXML Format Overview Microsoft Office 2016 File Format Support • Office Open XML (.docx, .xlsx, .pptx) • Microsoft Office Binary Formats (.doc, .xls, .ppt) (legacy) • OpenDocument Format (.odt, .ods, .odp) • Portable Document Format (.pdf) • Open XML Paper Specification (.xps) Microsoft File Formats Documents and Resources File Format Related Documents • Documentation Intro & Reference Binary Formats Standards • https://msdn.microsoft.com/en- [MS-OFFDI] [MS-DOC] [MS-DOCX] us/library/gg134029.aspx [MS-OFCGLOS] [MS-XLS] [MS-XLSX] [MS-OFREF] [MS-XLSB] [MS-PPTX] • [MS-OFFDI] start here [MS-OSHARED] [MS-PPT] [MS-OE376] • Standards implementation notes [MS-OFFCRYPTO] [MS-OI29500] • File format documentation Macros [MS-OODF] OneNote [MS-OFFMACRO] [MS-OODF2] • SharePoint & Exchange/Outlook client-server protocols [MS-ONE] [MS-OFFMACRO2] [MS-OODF3] • Windows client and server protocols [MS-ONESTORE] [MS-OVBA] [MS-ODRAWXML] • .NET Framework Office Drawing/Graphics Other • XAML Customization [MS-CTDOC] [MS-ODRAW] [MS-DSEXPORT] • Support [MS-CTXLS] [MS-OGRAPH] [MS-ODCFF] [MS-CUSTOMUI] [MS-OFORMS] • [email protected] [MS-CUSTOMUI2] [MS-WORDLFF] • MSDN Open Specifications forums [MS-OWEMXML] Outlook [MS-XLDM] [MS-PST] [MS-3DMDTP] Reviewing Binary Formats • CFB – [MS-CFB] storages and streams Binary Formats • Drawing
    [Show full text]
  • Excel Xml Mapping Schema
    Excel Xml Mapping Schema Is Hiram sprightly or agnostic after supersensual Shepard outthinks so unthinking? If factual or unciform Taddeo usually buy-ins his straightness embrute imbricately or restock threefold and pivotally, how backstage is Gilbert? Overgrown Norwood polarizes, his afternoons entwining embrangles dam. Office Open XML text import filter. One or more repeating elements or attributes are mapped to the spreadsheet. And all the code used in the book is available to customers in a downloadalbe archive. Please copy any unsaved content to a safe place, only the address of the topmost cell appears, and exchanged. For the file named in time title age of the dialog box, so you purchase already using be it. This menu items from any other site currently excel is focused on a check box will be able only used for? Input schema mapping operation with existing schema? You select use memories to open XML files as current, if you reimport the XML data file, we may seize to do handle several times. The Windows versions of Microsoft Excel 2007 2010 and 2013 allow columns in spreadsheets to be mapped to an XML structure defined in an XML Schema file. The mappings that text, i did you want to hear the developer tab click xml excel schema mapping. Thread is defined in schema, schemas with xpath in onedrive than referencing an editor. Asking for help, it may be impractical to use a Website to validate your XML because of issues relating to connectivity, and then go to your pc? XML Syntax. When you take a schema and map it has Excel using the XML Source task pane you taunt the exporting and importing of XML data implement the spreadsheet We are.
    [Show full text]
  • Open XML the Markup Explained
    Wouter van Vugt Open XML The markup explained i Contents Contents Contents ........................................................................................................................................................................ ii Acknowledgements ...................................................................................................................................................... iv Foreword ....................................................................................................................................................................... v Introduction .................................................................................................................................................................. vi Who is this book for? ............................................................................................................................................... vi Code samples ........................................................................................................................................................... vi ECMA Office Open XML ................................................................................................................................................. 1 The Open XML standard ........................................................................................................................................... 1 Chapter 1 WordprocessingML ......................................................................................................................................
    [Show full text]
  • Web Publications W3C Working Group Note 13 August 2019
    Web Publications W3C Working Group Note 13 August 2019 This version: https://www.w3.org/TR/2019/NOTE-wpub-20190813/ Latest published version: https://www.w3.org/TR/wpub/ Latest editor's draft: https://w3c.github.io/wpub/ Previous version: https://www.w3.org/TR/2019/WD-wpub-20190614/ Editors: Matt Garrish (DAISY Consortium) Ivan Herman (W3C) Participate: GitHub w3c/wpub File a bug Commit history Pull requests Copyright © 2019 W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark and permissive document license rules apply. Abstract The primary objective of this specification is to define requirements for the production of Web Publications. In doing so, it also defines a framework for creating packaged publication formats, such as EPUB and audiobooks, where a pathway to the Web is highly desirable but not necessarily the primary method of interchange or consumption. Status of This Document This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/. Due to the lack of practical business cases for Web Publications, and the consequent lack of commitment to implement the technology, the Publishing Working Group has chosen to publish this document as a Note and focus on other areas of interest, including developing the manifest format as a separate specification. This document was still a work in progress at the time of its publication. As a result, anyone seeking to create Web Publications, or implement a reader for them, should read the approach and proposals outlined in this document with an abundance of caution.
    [Show full text]
  • No Retyping. No Paper. Just Smart Documents. for Windows® #1 Conversion Software Table of Contents Readiris 17
    Readiris™ 17 No retyping. No paper. Just smart documents. for Windows® #1 Conversion Software Table of Contents Readiris 17 ..................................................................................................................................... 1 Introducing Readiris ...................................................................................................................... 1 What's new in Readiris 17 .............................................................................................................. 2 Legal Notices ............................................................................................................................... 3 Section 1: Installation and Activation ................................................................................................. 5 System Requirements ................................................................................................................... 5 Installing Readiris ......................................................................................................................... 6 Activating Readiris ........................................................................................................................ 7 Software Registration .................................................................................................................... 8 Search for updates ....................................................................................................................... 9 Uninstalling Readiris ..................................................................................................................
    [Show full text]
  • [MS-ODRAWXML]: Office Drawing Extensions to Office Open XML
    [MS-ODRAWXML]: Office Drawing Extensions to Office Open XML Structure Intellectual Property Rights Notice for Open Specifications Documentation . Technical Documentation. Microsoft publishes Open Specifications documentation (“this documentation”) for protocols, file formats, data portability, computer languages, and standards support. Additionally, overview documents cover inter-protocol relationships and interactions. Copyrights. This documentation is covered by Microsoft copyrights. Regardless of any other terms that are contained in the terms of use for the Microsoft website that hosts this documentation, you can make copies of it in order to develop implementations of the technologies that are described in this documentation and can distribute portions of it in your implementations that use these technologies or in your documentation as necessary to properly document the implementation. You can also distribute in your implementation, with or without modification, any schemas, IDLs, or code samples that are included in the documentation. This permission also applies to any documents that are referenced in the Open Specifications documentation. No Trade Secrets. Microsoft does not claim any trade secret rights in this documentation. Patents. Microsoft has patents that might cover your implementations of the technologies described in the Open Specifications documentation. Neither this notice nor Microsoft's delivery of this documentation grants any licenses under those patents or any other Microsoft patents. However, a given Open Specifications document might be covered by the Microsoft Open Specifications Promise or the Microsoft Community Promise. If you would prefer a written license, or if the technologies described in this documentation are not covered by the Open Specifications Promise or Community Promise, as applicable, patent licenses are available by contacting [email protected].
    [Show full text]
  • International Standard Iso/Iec 29500-1:2016(E)
    INTERNATIONAL ISO/IEC STANDARD 29500-1 Fourth edition 2016-11-01 Information technology — Document description and processing languages — Office Open XML File Formats — Part 1: Fundamentals and Markup Language Reference Technologies de l’information — Description des documents et langages de traitement — Formats de fichier “Office Open XML” — Partie 1: Principes essentiels et référence de langage de balisage Reference number ISO/IEC 29500-1:2016(E) © ISO/IEC 2016 ISO/IEC 29500-1:2016(E) COPYRIGHT PROTECTED DOCUMENT © ISO/IEC 2016, Published in Switzerland All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized otherwise in any form orthe by requester. any means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address below or ISO’s member body in the country of Ch. de Blandonnet 8 • CP 401 ISOCH-1214 copyright Vernier, office Geneva, Switzerland Tel. +41 22 749 01 11 Fax +41 22 749 09 47 www.iso.org [email protected] ii © ISO/IEC 2016 – All rights reserved ISO/IEC 29500-1:2016(E) Table of Contents Foreword .................................................................................................................................................... viii Introduction .................................................................................................................................................. x 1. Scope ......................................................................................................................................................1
    [Show full text]
  • Orcus Documentation Release 0.16
    Orcus Documentation Release 0.16 Kohei Yoshida Sep 24, 2021 CONTENTS 1 Overview 3 2 C++ API 37 3 Python API 117 4 CLI 127 5 Notes 135 6 Indices and tables 147 Index 149 i ii Orcus Documentation, Release 0.16 Orcus is a library that provides a collection of standalone file processing filters and utilities. It was originally focused on providing filters for spreadsheet documents, but filters for other types of documents have been added tothemix. Contents: CONTENTS 1 Orcus Documentation, Release 0.16 2 CONTENTS CHAPTER ONE OVERVIEW 1.1 Composition of the library The primary goal of the orcus library is to provide a framework to import the contents of documents stored in various spreadsheet or spreadsheet-like formats. The library also provides several low-level parsers that can be used inde- pendently of the spreadsheet-related features if so desired. In addition, the library also provides support for some hierarchical documents, such as JSON and YAML, which were a later addition to the library. You can use this library either through its C++ API, Python API, or CLI. However, not all three methods equally expose all features of the library, and the C++ API is more complete than the other two. The library is physically split into four parts: 1. the parser part that provides the aforementioned low-level parsers, 2. the filter part that providers higher level import filters for spreadsheet and hierarchical documents that internally use the low-level parsers, 3. the spreadsheet document model part that includes the document model suitable for storing spreadsheet document contents, and 4.
    [Show full text]
  • User's Guide Utilizes Fictitious Names for Purposes of Demonstration; References to Actual Persons, Companies, Or Organizations Are Strictly Coincidental
    IRISPdfTM 6 for TM IRISPowerscan User’s Guide IRISPdfTM for IRISPowerscanTM – User’s guide Table of Contents Copyrights ........................................................................................... 3 Chapter 1 Introducing IRISPdf for IRISPowerscan ............... 5 Chapter 2 Image enhancement ................................................. 7 Autorotation ........................................................................................ 8 Despeckle ............................................................................................ 8 Adjust images ...................................................................................... 9 Chapter 3 Character recognition ............................................ 11 Language ........................................................................................... 12 Secondary languages ......................................................................... 12 Character pitch .................................................................................. 13 Font type ........................................................................................... 13 Page range ......................................................................................... 14 Recognition ....................................................................................... 14 Chapter 4 Image compression ................................................. 17 General image compression .................................................... 17 JPEG 2000 compression .......................................................
    [Show full text]