ValueError: Excel file format cannot be determined, you must specify an engine manually.
I want sheet name of csv file using python
Related
I am reading from a .txt file into a dataframe using pandas read_csv(). The data is in this form in the txt file (this is a sample):
abcd,efgh,ijklm
qwerty,uoipqwrt
mznxlakspqowieu
As you can see there are different number of commas in each line. But ultimately I want to put each line of the text file in a single column. How can this be achieved?
I am trying to read excel files using python and writing each sheet's data into separate csv file.
I am able to write the whole data but its just I am unable to get the header values.
Is there any way this can be resolved.
Here is the piece of code I am writing.
xyz.to_csv(f, index=False, header=None)
I'm working with a large Excel file and need to create CSV exports of several worksheets at different times. When the exports are created they should be saved the same directory as the Excel file which can change but the macro should follow the file so that the CSV files are always created in the same location.
I have an Excel file that looks like this:
A B
1 Title_1 Description_1
2 Title_2 Description_2
Is it possible to output each title and description to individual Word files with column A for file name of the Word file and column B to its content?
For example the macro would create a new Word file give it file name 'Title_1' and copy 'Description_1'. Then create a new Word file again give it file name 'Title_2' and copy 'Description_2'. And do this until all data from the Excel file is copied.
Thank you for your time. :)
What you want to look into is called a "Mail Merge". Use a search engine and look for "mail merge excel word 2007" (or whatever year of MS Office that you are working with). You can create an excel macro that creates instances of word, populates the word doc with whatever you want from your excel spreadsheet, save the word doc with any name you want, export to PDF, etc.
Here are some hints to start you off:
in the VBE go to tools references and add one for Microsoft Office.
Use these two lines of code to create an object:
Dim MyWord
Set MyWord = CreateObject("Word.Application")
Now you can precede any code for word with MyWord for example to add a Document in word would be Documents.Add so remotely from Excel it will be MyWord.Documents.Add
You will want to loop through your cells in excel. On each iteration of the loop populate two variables, one with the text you want in the file and one with the file name.
Then simply use MyWord to enter the results of the variable then save the file using the result of the other variable.
Post back if you get stuck but give it a go first.
This is easy form any operating system, assuming you are using windows you will use a batch script(easiest).
First use save as/export on the data ribbon to save as a CSV.
Second you will need a batch script to read the CSV and use the first value as the file name the second value as the contents. If you want it to be a doc or docx instead of txt just rename the file in the same loop or add it to the file name when you output to text.
Here is a similar post with all the resources you would need to slap together a quick batch script.
read csv file through windows batch file and create txt file
I have an .mpp file which I need to get in an Excel format. That is, all the column headings in the .mpp file should be copied as the column headings of the new Excel sheet and all the data for each column in the .mpp file should be under each column in the excel sheet.
I don't know which kind of file .mpp is but if it's a text-like file with some columns you can open it with Excel without using a vba script.
On Windows : right click on the file, select "Open With", then select the "Excel" program.
An other way to do it is to open Excel and to open your file with it.
In both cases, Excel will ask you some information on the format of your file.
Hope this was helpfull.