Jump to content

Access Excel file in sharepoint


dannydy
 Share

Recommended Posts

Hi I.m new here and new to Autoit, still learning about Autoit.

i've a question here, may i know how to use autoit to access the excel file in sharepoint?Because i refer to some codes, unfortunely there were quite complicated and i dont understand at all.

appreaciate if anyone could help up.

Link to comment
Share on other sites

When you search the forum for "Sharepoint" you won't get too many hits. A lot of questions but not too many answers.

As AutoIt is similar to Visual Basic I would use Google to search for "Access Sharepoint Visual Basic" and see if you find any code. It should be relatively easy to convert this code to AutoIt.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Thanks water.

just did some studies, in order to talk to Sharepoint server 2010. I need to know the Sharepoint client object model, then use VB to interact with it.(This would be a little hard for me)

On the other hand, i've successfully created by using _IEGetObjById and _IEAction($oDiv,"click") access to my sharepoint and open the file in excel. i done it with the assist of IE builder 2,0(Get the element id).

Link to comment
Share on other sites

  • 5 years later...
On 1/15/2012 at 6:01 AM, dannydy said:

Thanks water.

 

just did some studies, in order to talk to Sharepoint server 2010. I need to know the Sharepoint client object model, then use VB to interact with it.(This would be a little hard for me)

 

On the other hand, i've successfully created by using _IEGetObjById and _IEAction($oDiv,"click") access to my sharepoint and open the file in excel. i done it with the assist of IE builder 2,0(Get the element id).

 

If you still have it available could you post the code you used to open the excel file off sharepoint? Thanks

Link to comment
Share on other sites

Dannydy has been offline for more than 4 1/2 years. Don't hold your breath for an answer ;)
IIRC users have created a few topics regarding SharePoint and Excel in th meantime.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I see :)

_Excel_BookOpen($oExcel, "https://sharepoint.com/teams/folder/filename.xlsx")

now returns @error = 2 ( Specified $sFilePath does not exist)?
If true, then the following modified _Excel_BookOpen function (please call _Excel_BookOpenEX in your script) should solve the problem:

; #FUNCTION# ====================================================================================================================
; Author ........: SEO <locodarwin at yahoo dot com>
; Modified.......: litlmike, water, GMK, willichan
; ===============================================================================================================================
Func _Excel_BookOpenEX($oExcel, $sFilePath, $bReadOnly = Default, $bVisible = Default, $sPassword = Default, $sWritePassword = Default, $bUpdateLinks = Default)
    ; Error handler, automatic cleanup at end of function
    Local $oError = ObjEvent("AutoIt.Error", "__Excel_COMErrFunc")
    #forceref $oError
    If Not IsObj($oExcel) Or ObjName($oExcel, 1) <> "_Application" Then Return SetError(1, @error, 0)
    If StringLeft($sFilePath, "HTTP") = 0 And Not FileExists($sFilePath) Then Return SetError(2, 0, 0) ; <== Modified
    If $bReadOnly = Default Then $bReadOnly = False
    If $bVisible = Default Then $bVisible = True
    Local $oWorkbook = $oExcel.Workbooks.Open($sFilePath, $bUpdateLinks, $bReadOnly, Default, $sPassword, $sWritePassword)
    If @error Then Return SetError(3, @error, 0)
    Local $oWindow = $oExcel.Windows($oWorkbook.Name)
    If IsObj($oWindow) Then $oWindow.Visible = $bVisible
    ; If a read-write workbook was opened read-only then set @extended = 1
    If $bReadOnly = False And $oWorkbook.Readonly = True Then Return SetError(0, 1, $oWorkbook)
    Return $oWorkbook
EndFunc   ;==>_Excel_BookOpenEX

If yes, then I'm going to update the function in AutoIt's repository.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • 1 month later...

_Excel_BookOpen and _Excel_BookOpenText have been modified to not check for existance of the workbook if parameter $sFilePath starts with "HTTP".
This fix will be part of the next beta version :)

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • 2 years later...

Hello @water,

I've stumbled across this today, when a script of mine wasn't working:

shouldn't the modified line be 

If Not StringLeft($sFilePath, 4) = "HTTP" And Not FileExists($sFilePath) Then Return SetError(2, 0, 0) ; <== Modified

 

rather than

If StringLeft($sFilePath, "HTTP") = 0 And Not FileExists($sFilePath) Then Return SetError(2, 0, 0) ; <== Modified

 

because I'm not sure if that StringLeft($sFilePath, "HTTP") = 0 actually works.

 

Cheers,

 

/Edit: Thanks @Danp2  - I wasn't aware of that other thread.

Edited by SEuBo
Link to comment
Share on other sites

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...