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

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')

im sorry...change

"wb = open_workbook(file)", to "wb=xlrd.open_workbook(fullpath)"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.