-1

Hi All,
>I am new to using python

> By using the below code am not getting the complete path of the file
>
> <script language="javascript" type="text/javascript">
> function getvaluetxt()
> {
> var str =
> document.getElementById('file').value;
> alert(str);
> }
> </script>
> <body>
> <form action="/" method="post"
> enctype="multipart/form-data">
> Pricelist:<input type="hidden"
> name="textbox1" id="textbox1" >
> <input type="file" name="file"
> id="file"/>
> <br>
> <input type="submit" value="upload"
> onclick="getvaluetxt()">
>
> </form>
>
> 1. How i can get the full path of the file?
> 2. I need to map the path with xlrd.
>
> for eg:- I need to give the path in book = xlrd.open_workbook(path)
>
> How i can do this?
>
> Regards,
> Nimmy

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by g_amanu
0
import xlrd
import os

path='foder' #put in the path to the folder where you saved all your excel files
dirList=os.listdir(path)

for file in dirList:
    fullpath=os.path.join(path,file)
    wb = xlrd.open_workbook(file)
    sh = wb.sheet_by_index(0) #or you can open the sheet by name
    sh = wb.sheet_by_name(u'Sheet1')
0

im sorry...change

"wb = open_workbook(file)", to "wb=xlrd.open_workbook(fullpath)"
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.