CakePHP 2.1 excel file export and import to database - excel

I am using cakephp 2.1 and developing an application which needed more data. I want to use excel file for import and export. Please suggest me some solutions to get it done.

Use Microsoft's "CSV for Excel" for importing data. It's the same as a generic CSV but then with different delimiters. If you want to create complex Excel sheets, then you should use something like PHPExcell.
The -1 on your question is for asking it wrongly. A quick Google Search would yield the same result as me typing this in...

Related

How to log in and auto fill values into a 'drupal form' from an 'excel file'?

So, there is this website where I have to log in and insert values in the add content->person roles and I have to take values from an excel file. I tried entering the values in the database directly but got nowhere. The database is too randomly generated.
I want to know- how to go by this problem? I think python would be the best way but I am more comfortable with java. The images bellow will help understand the situation better-
The log in from:
The form to be filled:
Try using feeds module:
https://www.drupal.org/project/feeds
Install it on you site first of course. Or look for some similar import module. Maybe this one:
https://www.drupal.org/project/datasources
If nothing succeeds then try making import script on your own. You have to parse document (would be much easier to open it from excel and export as CSV if possible http://php.net/manual/en/function.fgetcsv.php) and have some loop to write content into Drupal system. Use Drupal's functions for that, do not directly write to database. It's not hard as it looks like:
https://www.drupal.org/node/1388922

SQLite data into Excel?

I wish to pull data from a large SQLite database into Excel. I'll want to do so quite interactively so don't want to export CSVs or anything like that. I have seen the sqliteodbc website on ch-werner.de but does that work with Excel 2007?
What are the best options?
Actually I have gone through the ch-werner.de file mentioned in the question and it works well, even in Excel 2007. Simply make sure to register your database using the ODBC option in the Windows control panel.
Excel recognizes XML and the format is something like this:-
<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:html=\"http://www.w3.org/TR/REC-html40\">
<DocumentProperties xmlns=\"urn:schemas-microsoft-com:office:office\">
You might want to create a sample of the output you want in Excel, save it as XML data. Open your regular text edit, and voila... you got the XML skeleton.
Now programmatically converting SQLite to Excel, that's another thing. You didn't mention what language you're conversant with.

Import Excel File into Oracle [duplicate]

This question already has answers here:
Load Excel data sheet to Oracle database
(6 answers)
Closed 8 years ago.
I have an Excel file that I need to import into a (new) Oracle table. What is the best way to do this?
The simplest (technically) way is to export the contents as a CSV and use SQL*Loader to import it into the table. This link goes to the documentation for SQL*Loader, which will explain how to write a SQL*Loader control file.
If you need to automate the export to CSV this can be done through OLE automation or VBA code within the spreadsheet. You could also use VBA (shell) to execute the SQL*Loader command if you want to provide a facility for the end-user to initiate the load.
http://www.sharewareconnection.com/import-table-from-excel-for-oracle.htm
I'm pretty sure it's possible to set up an Excel file as an ODBC source, but don't ask me how to do that.
I generally just save the spreadsheet as CSV and import it using Oracle APEX's CSV import wizard.
If you need to perform any validation or cross-referencing on the data, I suggest using an entity relationship manager like Talend, etc. You can write scripts to do things like this, but a tool can make this a bit less painful.
Maybe this can help ?
http://oracleebusinesssuite.wordpress.com/2007/06/27/import-of-an-excel-or-any-other-file-external-data-into-oracle/
http://www.dba-oracle.com/oracle_tips_excel_spreadsheet.htm

How best to export native data to Excel without introducing dependency on Office?

Our product has the requirement of exporting its native format (essentially an XML file) to Excel for viewing/editing. However, what this entails is having a dependency on Excel (or Office) itself for our product build - something that we do not want.
What we have done is export the data from our native format to a csv file which can be opened in Excel. If user selects an option to open the generated report as well, we (try to) launch Excel application to open it (ofcourse it requires Excel to be already present on the client system).
The data for most part is flat list of records.
Is there a better format (or even a better way) to handle this requirement? This is a common requirement for many products - how do you handle this?
Excel versions, both 2007 and several previous, have native XML formats. 2007, obviously, is XML by default, and earlier versions have the ability to save as XML. This SO question deals with the issue. I'd guess a little inspection would give an idea of what's required. I don't know if a XSD/DTD exists for older versions, but a little creative Googling might yield something.
As other people pointed out, it is reasonably easy to generate Excel XML files. You can do this in multiple ways. For example:
By creating a template Excel XML document, and then using XML DOM to stuff your data into the template, or
Converting the template Excel XML into an XSLT, and then simply passing your proprietary XML as input to XSLT.
I'm using ExcelPackage to create spreadsheets in one of my side projects. Works pretty good, but (at least the version I'm using) its a bit limited when it comes to styling and calculations.
ExcelPackage lets you create OOXML docs (.xslx files) that are natively compat with 2k7, but you can download a plugin for previous versions of Office from MS.
We export our data either using Excel objects (COM based code) on client side or CSV file (usually on server side, but can be used on client side too). And we allow copy data from grids in simple html format, what can be pasted into Excel without problems.
For one customer we even had to export data [from sql stored procedure] into csv-like tab-separated format, but named file like xxxxx.xls - this way excel opened that file in more correct way than csv file. Ugly hack, but worked well.
CSV is most compatible format (no dependencies on external applications or libraries), but customers don't like it. Maybe we need to incorporate some XLS export code, this way all users will be happy :)
If .csv isn't formatted enough, you could create a template in Excel, and use a little bit of VBA code to import the CSV and format it appropriately. This way your app is only concerned with generating the .CSV, and will use the same .XLS for each export.
If you're careful, you should be able to get this to work with most versions of Excel seamlessly.
With Perl there are several modules that can be used to produce .xlsx files without requiring an Office installation. Among those :
https://metacpan.org/pod/Excel::Writer::XLSX is the most well-known, with support for many Excel features like colors, formatting, etc.
https://metacpan.org/pod/Excel::ValueWriter::XLSX (I'm actually the author) has less features but is optimized for fast writing of large amounts of data
If you are working in Java, Checkout the POI project from APACHE.
http://poi.apache.org/
Simple, nice, complete, powerful.
We started with Office on the server, but that's not very nice. We had to kill processes that hung, and had quite a bit of a performance dip. We thought about putting it on a different machine, but didn't bother after trying and using Aspose (commercial). We don't have a very large number of simultaneous users, but complex documents. Simple ones can be handled easier with csv.
I've used FlexCel Studio for a couple of projects now. It's very functional and fast. 100% managed code, no dependencies. Sounds like you'd use the "Reports" feature which allows you to define an empty report template in Excel, then pass datatable and volia, it's populated with your data.
TMS Software
We use a combination of OleDB and Interop. We found that Interop was much faster and used less memory, but it's a pain for compatibility issues, especially when using different language installs of Office.
OleDb has the advantage that you don't require Excel to be installed on the client machine. Both Interop and OleDb support multiple sheets (tables) per workbook which you cannot do with csv.
If you're using C# or VB.Net, and your data is in a a DataSet, DataTable or List<>, then you can use my free "Export to Excel" class.
It uses the free Microsoft OpenXML libraries (so you don't need to have Excel on your server), and lets you export your data into a "real" .xlsx file with just one line of code, eg:
DataSet ds = CreateSampleData();
CreateExcelFile.CreateExcelDocument(ds, "C:\\Sample.xlsx");
All source code is provided on the following page along with a demo project, completely free of charge (and popups !)
http://mikesknowledgebase.com/pages/CSharp/ExportToExcel.htm
Hope this helps !

How do I import an Excel Spreadsheet into a blog..?

We are interested in trying to import an Excel spreadsheet into our Blog.
A sample of the Excel spreadsheet that we generate each day and want to export into our Blog is located at:
http://www.wallstreetsignals.com/WhatsWorking.html
Our Blog is located at:
http://whatsworkinginthestockmarket.blogspot.com/
We are interested in a program or method that would allow us to just import the Excel spreadsheet into our Blog instead of having to hand input all the data, which is what we are doing now.
Thank you for your thoughts and the cost to have you help accomplish our goal.
Philip
WallStreetSignals.com
Well, outside of creating a program (which is possible, using PHP, Perl, Java, etc and either an excel input module or converting to CSV or XML and processing that)...
Have you considered using Google Documents or another online spreadsheet software? It's easy to import an excel spreadsheet, and then embed the spreadsheet in the blog post or webpage. Then if you need to change it, modify the google document spreadsheet and the changes are rendered on the webpage or blog post immediately.
-Adam
The easiest thing might be to use Google Docs. Upload your spreadsheet, then publish from Google Docs to your blog. See this article.
Can your blog consume XML? You can set up an XML Schema in Excel 2007 and just export it to an XML file. You would need to write an XSLT.
I also have a macro that will write out XML to a file... can upload that if it would help...
If your spreadsheet is generated by a macro, you could just modify a macro to generate html or some other sort of blog markup ready for copy and paste.
Excel can save as HTML, which you could then strip the metadata from and use in your website. Unfortunately the HTML that it generates is very bloated. If you do not mind client lock-in, you could consider embedding the XLS file directly on your website, and having your viewers use the IE embedded excel viewer.
If you can use ASP.NET you could use SpreadsheetGear for .NET to load an Excel workbook, grab values, formatted values or even images to display on a web page. There are live ASP.NET samples with source if you want to check it out.
Disclaimer: I work for SpreadsheetGear LLC

Resources